GCC Code Coverage Report


Directory: ./
File: bld/sql_yacc.yy
Date: 2022-12-13 11:44:05
Exec Total Coverage
Lines: 4705 5320 88.4%
Branches: 4176 7944 52.6%

Line Branch Exec Source
1 /*
2 Copyright (c) 2000, 2022, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is also distributed with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have included with MySQL.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24 /* sql_yacc.yy */
25
26 /**
27 @defgroup Parser Parser
28 @{
29 */
30
31 %{
32 /*
33 Note: YYTHD is passed as an argument to yyparse(), and subsequently to yylex().
34 */
35 #define YYP (YYTHD->m_parser_state)
36 #define YYLIP (& YYTHD->m_parser_state->m_lip)
37 #define YYPS (& YYTHD->m_parser_state->m_yacc)
38 #define YYCSCL (YYLIP->query_charset)
39 #define YYMEM_ROOT (YYTHD->mem_root)
40 #define YYCLIENT_NO_SCHEMA (YYTHD->get_protocol()->has_client_capability(CLIENT_NO_SCHEMA))
41
42 #define YYINITDEPTH 100
43 #define YYMAXDEPTH 3200 /* Because of 64K stack */
44 #define Lex (YYTHD->lex)
45 #define Select Lex->current_query_block()
46
47 #include <sys/types.h> // TODO: replace with cstdint
48
49 #include <algorithm>
50 #include <cerrno>
51 #include <climits>
52 #include <cstdlib>
53 #include <cstring>
54 #include <limits>
55 #include <memory>
56 #include <string>
57 #include <type_traits>
58 #include <utility>
59
60 #include "field_types.h"
61 #include "ft_global.h"
62 #include "lex_string.h"
63 #include "libbinlogevents/include/binlog_event.h"
64 #include "m_ctype.h"
65 #include "m_string.h"
66 #include "my_alloc.h"
67 #include "my_base.h"
68 #include "my_check_opt.h"
69 #include "my_dbug.h"
70 #include "my_inttypes.h" // TODO: replace with cstdint
71 #include "my_sqlcommand.h"
72 #include "my_sys.h"
73 #include "my_thread_local.h"
74 #include "my_time.h"
75 #include "myisam.h"
76 #include "myisammrg.h"
77 #include "mysql/mysql_lex_string.h"
78 #include "mysql/plugin.h"
79 #include "mysql/udf_registration_types.h"
80 #include "mysql_com.h"
81 #include "mysql_time.h"
82 #include "mysqld_error.h"
83 #include "prealloced_array.h"
84 #include "sql/auth/auth_acls.h"
85 #include "sql/auth/auth_common.h"
86 #include "sql/binlog.h" // for MAX_LOG_UNIQUE_FN_EXT
87 #include "sql/create_field.h"
88 #include "sql/dd/types/abstract_table.h" // TT_BASE_TABLE
89 #include "sql/dd/types/column.h"
90 #include "sql/derror.h"
91 #include "sql/event_parse_data.h"
92 #include "sql/field.h"
93 #include "sql/gis/srid.h" // gis::srid_t
94 #include "sql/handler.h"
95 #include "sql/item.h"
96 #include "sql/item_cmpfunc.h"
97 #include "sql/item_create.h"
98 #include "sql/item_func.h"
99 #include "sql/item_geofunc.h"
100 #include "sql/item_json_func.h"
101 #include "sql/item_regexp_func.h"
102 #include "sql/item_row.h"
103 #include "sql/item_strfunc.h"
104 #include "sql/item_subselect.h"
105 #include "sql/item_sum.h"
106 #include "sql/item_timefunc.h"
107 #include "sql-common/json_dom.h"
108 #include "sql-common/json_syntax_check.h" // is_valid_json_syntax
109 #include "sql/key_spec.h"
110 #include "sql/keycaches.h"
111 #include "sql/lex_symbol.h"
112 #include "sql/lex_token.h"
113 #include "sql/lexer_yystype.h"
114 #include "sql/mdl.h"
115 #include "sql/mem_root_array.h"
116 #include "sql/mysqld.h"
117 #include "sql/options_mysqld.h"
118 #include "sql/parse_location.h"
119 #include "sql/parse_tree_helpers.h"
120 #include "sql/parse_tree_node_base.h"
121 #include "sql/parser_yystype.h"
122 #include "sql/partition_element.h"
123 #include "sql/partition_info.h"
124 #include "sql/protocol.h"
125 #include "sql/query_options.h"
126 #include "sql/resourcegroups/platform/thread_attrs_api.h"
127 #include "sql/resourcegroups/resource_group_basic_types.h"
128 #include "sql/rpl_filter.h"
129 #include "sql/rpl_replica.h" // Sql_cmd_change_repl_filter
130 #include "sql/set_var.h"
131 #include "sql/sp.h"
132 #include "sql/sp_head.h"
133 #include "sql/sp_instr.h"
134 #include "sql/sp_pcontext.h"
135 #include "sql/spatial.h"
136 #include "sql/sql_admin.h" // Sql_cmd_analyze/Check..._table
137 #include "sql/sql_alter.h" // Sql_cmd_alter_table*
138 #include "sql/sql_backup_lock.h" // Sql_cmd_lock_instance
139 #include "sql/sql_class.h" /* Key_part_spec, enum_filetype */
140 #include "sql/sql_cmd_srs.h"
141 #include "sql/sql_connect.h"
142 #include "sql/sql_component.h"
143 #include "sql/sql_error.h"
144 #include "sql/sql_exchange.h"
145 #include "sql/sql_get_diagnostics.h" // Sql_cmd_get_diagnostics
146 #include "sql/sql_handler.h" // Sql_cmd_handler_*
147 #include "sql/sql_import.h" // Sql_cmd_import_table
148 #include "sql/sql_lex.h"
149 #include "sql/sql_list.h"
150 #include "sql/sql_parse.h" /* comp_*_creator */
151 #include "sql/sql_plugin.h" // plugin_is_ready
152 #include "sql/sql_profile.h"
153 #include "sql/sql_select.h" // Sql_cmd_select...
154 #include "sql/sql_servers.h"
155 #include "sql/sql_signal.h"
156 #include "sql/sql_table.h" /* primary_key_name */
157 #include "sql/sql_tablespace.h" // Sql_cmd_alter_tablespace
158 #include "sql/sql_trigger.h" // Sql_cmd_create_trigger
159 #include "sql/sql_udf.h"
160 #include "sql/system_variables.h"
161 #include "sql/table.h"
162 #include "sql/table_function.h"
163 #include "sql/thr_malloc.h"
164 #include "sql/trigger_def.h"
165 #include "sql/window_lex.h"
166 #include "sql/xa/sql_cmd_xa.h" // Sql_cmd_xa...
167 #include "sql_chars.h"
168 #include "sql_string.h"
169 #include "thr_lock.h"
170 #include "violite.h"
171
172 /* this is to get the bison compilation windows warnings out */
173 #ifdef _MSC_VER
174 /* warning C4065: switch statement contains 'default' but no 'case' labels */
175 #pragma warning (disable : 4065)
176 #endif
177
178 using std::min;
179 using std::max;
180
181 /// The maximum number of histogram buckets.
182 static const int MAX_NUMBER_OF_HISTOGRAM_BUCKETS= 1024;
183
184 /// The default number of histogram buckets when the user does not specify it
185 /// explicitly. A value of 100 is chosen because the gain in accuracy above this
186 /// point seems to be generally low.
187 static const int DEFAULT_NUMBER_OF_HISTOGRAM_BUCKETS= 100;
188
189 int yylex(void *yylval, void *yythd);
190
191 #define yyoverflow(A,B,C,D,E,F,G,H) \
192 { \
193 ulong val= *(H); \
194 if (my_yyoverflow((B), (D), (F), &val)) \
195 { \
196 yyerror(NULL, YYTHD, NULL, (const char*) (A));\
197 return 2; \
198 } \
199 else \
200 { \
201 *(H)= (YYSIZE_T)val; \
202 } \
203 }
204
205 #define MYSQL_YYABORT YYABORT
206
207 #define MYSQL_YYABORT_ERROR(...) \
208 do \
209 { \
210 my_error(__VA_ARGS__); \
211 MYSQL_YYABORT; \
212 } while(0)
213
214 #define MYSQL_YYABORT_UNLESS(A) \
215 if (!(A)) \
216 { \
217 YYTHD->syntax_error(); \
218 MYSQL_YYABORT; \
219 }
220
221 #define NEW_PTN new(YYMEM_ROOT)
222
223
224 /**
225 Parse_tree_node::contextualize() function call wrapper
226 */
227 #define CONTEXTUALIZE(x) \
228 do \
229 { \
230 std::remove_reference<decltype(*x)>::type::context_t pc(YYTHD, Select); \
231 if (YYTHD->is_error() || \
232 (YYTHD->lex->will_contextualize && (x)->contextualize(&pc))) \
233 MYSQL_YYABORT; \
234 } while(0)
235
236
237 /**
238 Item::itemize() function call wrapper
239 */
240 #define ITEMIZE(x, y) \
241 do \
242 { \
243 Parse_context pc(YYTHD, Select); \
244 if (YYTHD->is_error() || \
245 (YYTHD->lex->will_contextualize && (x)->itemize(&pc, (y)))) \
246 MYSQL_YYABORT; \
247 } while(0)
248
249 /**
250 Parse_tree_root::make_cmd() wrapper to raise postponed error message on OOM
251
252 @note x may be NULL because of OOM error.
253 */
254 #define MAKE_CMD(x) \
255 do \
256 { \
257 if (YYTHD->is_error() || Lex->make_sql_cmd(x)) \
258 MYSQL_YYABORT; \
259 } while(0)
260
261
262 #ifndef NDEBUG
263 #define YYDEBUG 1
264 #else
265 #define YYDEBUG 0
266 #endif
267
268
269 /**
270 @brief Bison callback to report a syntax/OOM error
271
272 This function is invoked by the bison-generated parser
273 when a syntax error or an out-of-memory
274 condition occurs, then the parser function MYSQLparse()
275 returns 1 to the caller.
276
277 This function is not invoked when the
278 parser is requested to abort by semantic action code
279 by means of YYABORT or YYACCEPT macros..
280
281 This function is not for use in semantic actions and is internal to
282 the parser, as it performs some pre-return cleanup.
283 In semantic actions, please use syntax_error or my_error to
284 push an error into the error stack and MYSQL_YYABORT
285 to abort from the parser.
286 */
287
288 static
289 3534 void MYSQLerror(YYLTYPE *location, THD *thd, Parse_tree_root **, const char *s)
290 {
291
1/2
✓ Branch 0 taken 3534 times.
✗ Branch 1 not taken.
3534 if (strcmp(s, "syntax error") == 0) {
292 3534 thd->syntax_error_at(*location);
293 } else if (strcmp(s, "memory exhausted") == 0) {
294 my_error(ER_DA_OOM, MYF(0));
295 } else {
296 // Find omitted error messages in the generated file (sql_yacc.cc) and fix:
297 assert(false);
298 my_error(ER_UNKNOWN_ERROR, MYF(0));
299 }
300 3534 }
301
302
303 #ifndef NDEBUG
304 void turn_parser_debug_on()
305 {
306 /*
307 MYSQLdebug is in sql/sql_yacc.cc, in bison generated code.
308 Turning this option on is **VERY** verbose, and should be
309 used when investigating a syntax error problem only.
310
311 The syntax to run with bison traces is as follows :
312 - Starting a server manually :
313 mysqld --debug="d,parser_debug" ...
314 - Running a test :
315 mysql-test-run.pl --mysqld="--debug=d,parser_debug" ...
316
317 The result will be in the process stderr (var/log/master.err)
318 */
319
320 extern int yydebug;
321 yydebug= 1;
322 }
323 #endif
324
325 69517 static bool is_native_function(const LEX_STRING &name)
326 {
327
2/2
✓ Branch 0 taken 2030 times.
✓ Branch 1 taken 67487 times.
69517 if (find_native_function_builder(name) != nullptr)
328 2030 return true;
329
330
2/2
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 67476 times.
67487 if (is_lex_native_function(&name))
331 11 return true;
332
333 67476 return false;
334 }
335
336
337 /**
338 Helper action for a case statement (entering the CASE).
339 This helper is used for both 'simple' and 'searched' cases.
340 This helper, with the other case_stmt_action_..., is executed when
341 the following SQL code is parsed:
342 <pre>
343 CREATE PROCEDURE proc_19194_simple(i int)
344 BEGIN
345 DECLARE str CHAR(10);
346
347 CASE i
348 WHEN 1 THEN SET str="1";
349 WHEN 2 THEN SET str="2";
350 WHEN 3 THEN SET str="3";
351 ELSE SET str="unknown";
352 END CASE;
353
354 SELECT str;
355 END
356 </pre>
357 The actions are used to generate the following code:
358 <pre>
359 SHOW PROCEDURE CODE proc_19194_simple;
360 Pos Instruction
361 0 set str@1 NULL
362 1 set_case_expr (12) 0 i@0
363 2 jump_if_not 5(12) (case_expr@0 = 1)
364 3 set str@1 _latin1'1'
365 4 jump 12
366 5 jump_if_not 8(12) (case_expr@0 = 2)
367 6 set str@1 _latin1'2'
368 7 jump 12
369 8 jump_if_not 11(12) (case_expr@0 = 3)
370 9 set str@1 _latin1'3'
371 10 jump 12
372 11 set str@1 _latin1'unknown'
373 12 stmt 0 "SELECT str"
374 </pre>
375
376 @param thd thread handler
377 */
378
379 1184 static void case_stmt_action_case(THD *thd)
380 {
381 1184 LEX *lex= thd->lex;
382 1184 sp_head *sp= lex->sphead;
383 1184 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
384
385 1184 sp->m_parser_data.new_cont_backpatch();
386
387 /*
388 BACKPATCH: Creating target label for the jump to
389 "case_stmt_action_end_case"
390 (Instruction 12 in the example)
391 */
392
393 1184 pctx->push_label(thd, EMPTY_CSTR, sp->instructions());
394 1184 }
395
396 /**
397 Helper action for a case then statements.
398 This helper is used for both 'simple' and 'searched' cases.
399 @param lex the parser lex context
400 */
401
402 24467 static bool case_stmt_action_then(THD *thd, LEX *lex)
403 {
404 24467 sp_head *sp= lex->sphead;
405 24467 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
406
407 sp_instr_jump *i =
408
1/2
✓ Branch 0 taken 24467 times.
✗ Branch 1 not taken.
24467 new (thd->mem_root) sp_instr_jump(sp->instructions(), pctx);
409
410
3/6
✓ Branch 0 taken 24467 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24467 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 24467 times.
24467 if (!i || sp->add_instr(thd, i))
411 return true;
412
413 /*
414 BACKPATCH: Resolving forward jump from
415 "case_stmt_action_when" to "case_stmt_action_then"
416 (jump_if_not from instruction 2 to 5, 5 to 8 ... in the example)
417 */
418
419 24467 sp->m_parser_data.do_backpatch(pctx->pop_label(), sp->instructions());
420
421 /*
422 BACKPATCH: Registering forward jump from
423 "case_stmt_action_then" to "case_stmt_action_end_case"
424 (jump from instruction 4 to 12, 7 to 12 ... in the example)
425 */
426
427
1/2
✓ Branch 0 taken 24467 times.
✗ Branch 1 not taken.
24467 return sp->m_parser_data.add_backpatch_entry(i, pctx->last_label());
428 }
429
430 /**
431 Helper action for an end case.
432 This helper is used for both 'simple' and 'searched' cases.
433 @param lex the parser lex context
434 @param simple true for simple cases, false for searched cases
435 */
436
437 1176 static void case_stmt_action_end_case(LEX *lex, bool simple)
438 {
439 1176 sp_head *sp= lex->sphead;
440 1176 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
441
442 /*
443 BACKPATCH: Resolving forward jump from
444 "case_stmt_action_then" to "case_stmt_action_end_case"
445 (jump from instruction 4 to 12, 7 to 12 ... in the example)
446 */
447 1176 sp->m_parser_data.do_backpatch(pctx->pop_label(), sp->instructions());
448
449
2/2
✓ Branch 0 taken 596 times.
✓ Branch 1 taken 580 times.
1176 if (simple)
450 596 pctx->pop_case_expr_id();
451
452 1176 sp->m_parser_data.do_cont_backpatch(sp->instructions());
453 1176 }
454
455
456 4111 static void init_index_hints(List<Index_hint> *hints, index_hint_type type,
457 index_clause_map clause)
458 {
459
1/2
✓ Branch 0 taken 4111 times.
✗ Branch 1 not taken.
4111 List_iterator<Index_hint> it(*hints);
460 Index_hint *hint;
461
2/2
✓ Branch 0 taken 4302 times.
✓ Branch 1 taken 4111 times.
8413 while ((hint= it++))
462 {
463 4302 hint->type= type;
464 4302 hint->clause= clause;
465 }
466 4111 }
467
468 bool my_yyoverflow(short **a, YYSTYPE **b, YYLTYPE **c, ulong *yystacksize);
469
470 #include "sql/parse_tree_column_attrs.h"
471 #include "sql/parse_tree_handler.h"
472 #include "sql/parse_tree_items.h"
473 #include "sql/parse_tree_nodes.h"
474 #include "sql/parse_tree_partitions.h"
475
476 222 void warn_about_deprecated_national(THD *thd)
477 {
478
5/6
✓ Branch 0 taken 222 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 218 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 218 times.
✓ Branch 5 taken 4 times.
444 if (native_strcasecmp(national_charset_info->csname, "utf8") == 0 ||
479 222 native_strcasecmp(national_charset_info->csname, "utf8mb3") == 0)
480 218 push_warning(thd, ER_DEPRECATED_NATIONAL);
481 222 }
482
483 8594 void warn_about_deprecated_binary(THD *thd)
484 {
485 8594 push_deprecated_warn(thd, "BINARY as attribute of a type",
486 "a CHARACTER SET clause with _bin collation");
487 8594 }
488
489 %}
490
491 %start start_entry
492
493 %parse-param { class THD *YYTHD }
494 %parse-param { class Parse_tree_root **parse_tree }
495
496 %lex-param { class THD *YYTHD }
497 %pure-parser /* We have threads */
498 /*
499 1. We do not accept any reduce/reduce conflicts
500 2. We should not introduce new shift/reduce conflicts any more.
501 */
502 %expect 66
503
504
505 /*
506 MAINTAINER:
507
508 1) Comments for TOKENS.
509
510 For each token, please include in the same line a comment that contains
511 one or more of the following tags:
512
513 SQL-2015-N : Non Reserved keyword as per SQL-2015 draft
514 SQL-2015-R : Reserved keyword as per SQL-2015 draft
515 SQL-2003-R : Reserved keyword as per SQL-2003
516 SQL-2003-N : Non Reserved keyword as per SQL-2003
517 SQL-1999-R : Reserved keyword as per SQL-1999
518 SQL-1999-N : Non Reserved keyword as per SQL-1999
519 MYSQL : MySQL extension (unspecified)
520 MYSQL-FUNC : MySQL extension, function
521 INTERNAL : Not a real token, lex optimization
522 OPERATOR : SQL operator
523 FUTURE-USE : Reserved for futur use
524
525 This makes the code grep-able, and helps maintenance.
526
527 2) About token values
528
529 Token values are assigned by bison, in order of declaration.
530
531 Token values are used in query DIGESTS.
532 To make DIGESTS stable, it is desirable to avoid changing token values.
533
534 In practice, this means adding new tokens at the end of the list,
535 in the current release section (8.0),
536 instead of adding them in the middle of the list.
537
538 Failing to comply with instructions below will trigger build failure,
539 as this process is enforced by gen_lex_token.
540
541 3) Instructions to add a new token:
542
543 Add the new token at the end of the list,
544 in the MySQL 8.0 section.
545
546 4) Instructions to remove an old token:
547
548 Do not remove the token, rename it as follows:
549 %token OBSOLETE_TOKEN_<NNN> / * was: TOKEN_FOO * /
550 where NNN is the token value (found in sql_yacc.h)
551
552 For example, see OBSOLETE_TOKEN_820
553 */
554
555 /*
556 Tokens from MySQL 5.7, keep in alphabetical order.
557 */
558
559 %token ABORT_SYM 258 /* INTERNAL (used in lex) */
560 %token ACCESSIBLE_SYM 259
561 %token<lexer.keyword> ACCOUNT_SYM 260
562 %token<lexer.keyword> ACTION 261 /* SQL-2003-N */
563 %token ADD 262 /* SQL-2003-R */
564 %token<lexer.keyword> ADDDATE_SYM 263 /* MYSQL-FUNC */
565 %token<lexer.keyword> AFTER_SYM 264 /* SQL-2003-N */
566 %token<lexer.keyword> AGAINST 265
567 %token<lexer.keyword> AGGREGATE_SYM 266
568 %token<lexer.keyword> ALGORITHM_SYM 267
569 %token ALL 268 /* SQL-2003-R */
570 %token ALTER 269 /* SQL-2003-R */
571 %token<lexer.keyword> ALWAYS_SYM 270
572 %token OBSOLETE_TOKEN_271 271 /* was: ANALYSE_SYM */
573 %token ANALYZE_SYM 272
574 %token AND_AND_SYM 273 /* OPERATOR */
575 %token AND_SYM 274 /* SQL-2003-R */
576 %token<lexer.keyword> ANY_SYM 275 /* SQL-2003-R */
577 %token AS 276 /* SQL-2003-R */
578 %token ASC 277 /* SQL-2003-N */
579 %token<lexer.keyword> ASCII_SYM 278 /* MYSQL-FUNC */
580 %token ASENSITIVE_SYM 279 /* FUTURE-USE */
581 %token<lexer.keyword> AT_SYM 280 /* SQL-2003-R */
582 %token<lexer.keyword> AUTOEXTEND_SIZE_SYM 281
583 %token<lexer.keyword> AUTO_INC 282
584 %token<lexer.keyword> AVG_ROW_LENGTH 283
585 %token<lexer.keyword> AVG_SYM 284 /* SQL-2003-N */
586 %token<lexer.keyword> BACKUP_SYM 285
587 %token BEFORE_SYM 286 /* SQL-2003-N */
588 %token<lexer.keyword> BEGIN_SYM 287 /* SQL-2003-R */
589 %token BETWEEN_SYM 288 /* SQL-2003-R */
590 %token BIGINT_SYM 289 /* SQL-2003-R */
591 %token BINARY_SYM 290 /* SQL-2003-R */
592 %token<lexer.keyword> BINLOG_SYM 291
593 %token BIN_NUM 292
594 %token BIT_AND_SYM 293 /* MYSQL-FUNC */
595 %token BIT_OR_SYM 294 /* MYSQL-FUNC */
596 %token<lexer.keyword> BIT_SYM 295 /* MYSQL-FUNC */
597 %token BIT_XOR_SYM 296 /* MYSQL-FUNC */
598 %token BLOB_SYM 297 /* SQL-2003-R */
599 %token<lexer.keyword> BLOCK_SYM 298
600 %token<lexer.keyword> BOOLEAN_SYM 299 /* SQL-2003-R */
601 %token<lexer.keyword> BOOL_SYM 300
602 %token BOTH 301 /* SQL-2003-R */
603 %token<lexer.keyword> BTREE_SYM 302
604 %token BY 303 /* SQL-2003-R */
605 %token<lexer.keyword> BYTE_SYM 304
606 %token<lexer.keyword> CACHE_SYM 305
607 %token CALL_SYM 306 /* SQL-2003-R */
608 %token CASCADE 307 /* SQL-2003-N */
609 %token<lexer.keyword> CASCADED 308 /* SQL-2003-R */
610 %token CASE_SYM 309 /* SQL-2003-R */
611 %token CAST_SYM 310 /* SQL-2003-R */
612 %token<lexer.keyword> CATALOG_NAME_SYM 311 /* SQL-2003-N */
613 %token<lexer.keyword> CHAIN_SYM 312 /* SQL-2003-N */
614 %token CHANGE 313
615 %token<lexer.keyword> CHANGED 314
616 %token<lexer.keyword> CHANNEL_SYM 315
617 %token<lexer.keyword> CHARSET 316
618 %token CHAR_SYM 317 /* SQL-2003-R */
619 %token<lexer.keyword> CHECKSUM_SYM 318
620 %token CHECK_SYM 319 /* SQL-2003-R */
621 %token<lexer.keyword> CIPHER_SYM 320
622 %token<lexer.keyword> CLASS_ORIGIN_SYM 321 /* SQL-2003-N */
623 %token<lexer.keyword> CLIENT_SYM 322
624 %token<lexer.keyword> CLOSE_SYM 323 /* SQL-2003-R */
625 %token<lexer.keyword> COALESCE 324 /* SQL-2003-N */
626 %token<lexer.keyword> CODE_SYM 325
627 %token COLLATE_SYM 326 /* SQL-2003-R */
628 %token<lexer.keyword> COLLATION_SYM 327 /* SQL-2003-N */
629 %token<lexer.keyword> COLUMNS 328
630 %token COLUMN_SYM 329 /* SQL-2003-R */
631 %token<lexer.keyword> COLUMN_FORMAT_SYM 330
632 %token<lexer.keyword> COLUMN_NAME_SYM 331 /* SQL-2003-N */
633 %token<lexer.keyword> COMMENT_SYM 332
634 %token<lexer.keyword> COMMITTED_SYM 333 /* SQL-2003-N */
635 %token<lexer.keyword> COMMIT_SYM 334 /* SQL-2003-R */
636 %token<lexer.keyword> COMPACT_SYM 335
637 %token<lexer.keyword> COMPLETION_SYM 336
638 %token<lexer.keyword> COMPRESSED_SYM 337
639 %token<lexer.keyword> COMPRESSION_SYM 338
640 %token<lexer.keyword> ENCRYPTION_SYM 339
641 %token<lexer.keyword> CONCURRENT 340
642 %token CONDITION_SYM 341 /* SQL-2003-R, SQL-2008-R */
643 %token<lexer.keyword> CONNECTION_SYM 342
644 %token<lexer.keyword> CONSISTENT_SYM 343
645 %token CONSTRAINT 344 /* SQL-2003-R */
646 %token<lexer.keyword> CONSTRAINT_CATALOG_SYM 345 /* SQL-2003-N */
647 %token<lexer.keyword> CONSTRAINT_NAME_SYM 346 /* SQL-2003-N */
648 %token<lexer.keyword> CONSTRAINT_SCHEMA_SYM 347 /* SQL-2003-N */
649 %token<lexer.keyword> CONTAINS_SYM 348 /* SQL-2003-N */
650 %token<lexer.keyword> CONTEXT_SYM 349
651 %token CONTINUE_SYM 350 /* SQL-2003-R */
652 %token CONVERT_SYM 351 /* SQL-2003-N */
653 %token COUNT_SYM 352 /* SQL-2003-N */
654 %token<lexer.keyword> CPU_SYM 353
655 %token CREATE 354 /* SQL-2003-R */
656 %token CROSS 355 /* SQL-2003-R */
657 %token CUBE_SYM 356 /* SQL-2003-R */
658 %token CURDATE 357 /* MYSQL-FUNC */
659 %token<lexer.keyword> CURRENT_SYM 358 /* SQL-2003-R */
660 %token CURRENT_USER 359 /* SQL-2003-R */
661 %token CURSOR_SYM 360 /* SQL-2003-R */
662 %token<lexer.keyword> CURSOR_NAME_SYM 361 /* SQL-2003-N */
663 %token CURTIME 362 /* MYSQL-FUNC */
664 %token DATABASE 363
665 %token DATABASES 364
666 %token<lexer.keyword> DATAFILE_SYM 365
667 %token<lexer.keyword> DATA_SYM 366 /* SQL-2003-N */
668 %token<lexer.keyword> DATETIME_SYM 367 /* MYSQL */
669 %token DATE_ADD_INTERVAL 368 /* MYSQL-FUNC */
670 %token DATE_SUB_INTERVAL 369 /* MYSQL-FUNC */
671 %token<lexer.keyword> DATE_SYM 370 /* SQL-2003-R */
672 %token DAY_HOUR_SYM 371
673 %token DAY_MICROSECOND_SYM 372
674 %token DAY_MINUTE_SYM 373
675 %token DAY_SECOND_SYM 374
676 %token<lexer.keyword> DAY_SYM 375 /* SQL-2003-R */
677 %token<lexer.keyword> DEALLOCATE_SYM 376 /* SQL-2003-R */
678 %token DECIMAL_NUM 377
679 %token DECIMAL_SYM 378 /* SQL-2003-R */
680 %token DECLARE_SYM 379 /* SQL-2003-R */
681 %token DEFAULT_SYM 380 /* SQL-2003-R */
682 %token<lexer.keyword> DEFAULT_AUTH_SYM 381 /* INTERNAL */
683 %token<lexer.keyword> DEFINER_SYM 382
684 %token DELAYED_SYM 383
685 %token<lexer.keyword> DELAY_KEY_WRITE_SYM 384
686 %token DELETE_SYM 385 /* SQL-2003-R */
687 %token DESC 386 /* SQL-2003-N */
688 %token DESCRIBE 387 /* SQL-2003-R */
689 %token OBSOLETE_TOKEN_388 388 /* was: DES_KEY_FILE */
690 %token DETERMINISTIC_SYM 389 /* SQL-2003-R */
691 %token<lexer.keyword> DIAGNOSTICS_SYM 390 /* SQL-2003-N */
692 %token<lexer.keyword> DIRECTORY_SYM 391
693 %token<lexer.keyword> DISABLE_SYM 392
694 %token<lexer.keyword> DISCARD_SYM 393 /* MYSQL */
695 %token<lexer.keyword> DISK_SYM 394
696 %token DISTINCT 395 /* SQL-2003-R */
697 %token DIV_SYM 396
698 %token DOUBLE_SYM 397 /* SQL-2003-R */
699 %token<lexer.keyword> DO_SYM 398
700 %token DROP 399 /* SQL-2003-R */
701 %token DUAL_SYM 400
702 %token<lexer.keyword> DUMPFILE 401
703 %token<lexer.keyword> DUPLICATE_SYM 402
704 %token<lexer.keyword> DYNAMIC_SYM 403 /* SQL-2003-R */
705 %token EACH_SYM 404 /* SQL-2003-R */
706 %token ELSE 405 /* SQL-2003-R */
707 %token ELSEIF_SYM 406
708 %token<lexer.keyword> ENABLE_SYM 407
709 %token ENCLOSED 408
710 %token<lexer.keyword> END 409 /* SQL-2003-R */
711 %token<lexer.keyword> ENDS_SYM 410
712 %token END_OF_INPUT 411 /* INTERNAL */
713 %token<lexer.keyword> ENGINES_SYM 412
714 %token<lexer.keyword> ENGINE_SYM 413
715 %token<lexer.keyword> ENUM_SYM 414 /* MYSQL */
716 %token EQ 415 /* OPERATOR */
717 %token EQUAL_SYM 416 /* OPERATOR */
718 %token<lexer.keyword> ERROR_SYM 417
719 %token<lexer.keyword> ERRORS 418
720 %token ESCAPED 419
721 %token<lexer.keyword> ESCAPE_SYM 420 /* SQL-2003-R */
722 %token<lexer.keyword> EVENTS_SYM 421
723 %token<lexer.keyword> EVENT_SYM 422
724 %token<lexer.keyword> EVERY_SYM 423 /* SQL-2003-N */
725 %token<lexer.keyword> EXCHANGE_SYM 424
726 %token<lexer.keyword> EXECUTE_SYM 425 /* SQL-2003-R */
727 %token EXISTS 426 /* SQL-2003-R */
728 %token EXIT_SYM 427
729 %token<lexer.keyword> EXPANSION_SYM 428
730 %token<lexer.keyword> EXPIRE_SYM 429
731 %token<lexer.keyword> EXPORT_SYM 430
732 %token<lexer.keyword> EXTENDED_SYM 431
733 %token<lexer.keyword> EXTENT_SIZE_SYM 432
734 %token EXTRACT_SYM 433 /* SQL-2003-N */
735 %token FALSE_SYM 434 /* SQL-2003-R */
736 %token<lexer.keyword> FAST_SYM 435
737 %token<lexer.keyword> FAULTS_SYM 436
738 %token FETCH_SYM 437 /* SQL-2003-R */
739 %token<lexer.keyword> FILE_SYM 438
740 %token<lexer.keyword> FILE_BLOCK_SIZE_SYM 439
741 %token<lexer.keyword> FILTER_SYM 440
742 %token<lexer.keyword> FIRST_SYM 441 /* SQL-2003-N */
743 %token<lexer.keyword> FIXED_SYM 442
744 %token FLOAT_NUM 443
745 %token FLOAT_SYM 444 /* SQL-2003-R */
746 %token<lexer.keyword> FLUSH_SYM 445
747 %token<lexer.keyword> FOLLOWS_SYM 446 /* MYSQL */
748 %token FORCE_SYM 447
749 %token FOREIGN 448 /* SQL-2003-R */
750 %token FOR_SYM 449 /* SQL-2003-R */
751 %token<lexer.keyword> FORMAT_SYM 450
752 %token<lexer.keyword> FOUND_SYM 451 /* SQL-2003-R */
753 %token FROM 452
754 %token<lexer.keyword> FULL 453 /* SQL-2003-R */
755 %token FULLTEXT_SYM 454
756 %token FUNCTION_SYM 455 /* SQL-2003-R */
757 %token GE 456
758 %token<lexer.keyword> GENERAL 457
759 %token GENERATED 458
760 %token<lexer.keyword> GROUP_REPLICATION 459
761 %token<lexer.keyword> GEOMETRYCOLLECTION_SYM 460 /* MYSQL */
762 %token<lexer.keyword> GEOMETRY_SYM 461
763 %token<lexer.keyword> GET_FORMAT 462 /* MYSQL-FUNC */
764 %token GET_SYM 463 /* SQL-2003-R */
765 %token<lexer.keyword> GLOBAL_SYM 464 /* SQL-2003-R */
766 %token GRANT 465 /* SQL-2003-R */
767 %token<lexer.keyword> GRANTS 466
768 %token GROUP_SYM 467 /* SQL-2003-R */
769 %token GROUP_CONCAT_SYM 468
770 %token GT_SYM 469 /* OPERATOR */
771 %token<lexer.keyword> HANDLER_SYM 470
772 %token<lexer.keyword> HASH_SYM 471
773 %token HAVING 472 /* SQL-2003-R */
774 %token<lexer.keyword> HELP_SYM 473
775 %token HEX_NUM 474
776 %token HIGH_PRIORITY 475
777 %token<lexer.keyword> HOST_SYM 476
778 %token<lexer.keyword> HOSTS_SYM 477
779 %token HOUR_MICROSECOND_SYM 478
780 %token HOUR_MINUTE_SYM 479
781 %token HOUR_SECOND_SYM 480
782 %token<lexer.keyword> HOUR_SYM 481 /* SQL-2003-R */
783 %token IDENT 482
784 %token<lexer.keyword> IDENTIFIED_SYM 483
785 %token IDENT_QUOTED 484
786 %token IF 485
787 %token IGNORE_SYM 486
788 %token<lexer.keyword> IGNORE_SERVER_IDS_SYM 487
789 %token<lexer.keyword> IMPORT 488
790 %token<lexer.keyword> INDEXES 489
791 %token INDEX_SYM 490
792 %token INFILE 491
793 %token<lexer.keyword> INITIAL_SIZE_SYM 492
794 %token INNER_SYM 493 /* SQL-2003-R */
795 %token INOUT_SYM 494 /* SQL-2003-R */
796 %token INSENSITIVE_SYM 495 /* SQL-2003-R */
797 %token INSERT_SYM 496 /* SQL-2003-R */
798 %token<lexer.keyword> INSERT_METHOD 497
799 %token<lexer.keyword> INSTANCE_SYM 498
800 %token<lexer.keyword> INSTALL_SYM 499
801 %token INTERVAL_SYM 500 /* SQL-2003-R */
802 %token INTO 501 /* SQL-2003-R */
803 %token INT_SYM 502 /* SQL-2003-R */
804 %token<lexer.keyword> INVOKER_SYM 503
805 %token IN_SYM 504 /* SQL-2003-R */
806 %token IO_AFTER_GTIDS 505 /* MYSQL, FUTURE-USE */
807 %token IO_BEFORE_GTIDS 506 /* MYSQL, FUTURE-USE */
808 %token<lexer.keyword> IO_SYM 507
809 %token<lexer.keyword> IPC_SYM 508
810 %token IS 509 /* SQL-2003-R */
811 %token<lexer.keyword> ISOLATION 510 /* SQL-2003-R */
812 %token<lexer.keyword> ISSUER_SYM 511
813 %token ITERATE_SYM 512
814 %token JOIN_SYM 513 /* SQL-2003-R */
815 %token JSON_SEPARATOR_SYM 514 /* MYSQL */
816 %token<lexer.keyword> JSON_SYM 515 /* MYSQL */
817 %token KEYS 516
818 %token<lexer.keyword> KEY_BLOCK_SIZE 517
819 %token KEY_SYM 518 /* SQL-2003-N */
820 %token KILL_SYM 519
821 %token<lexer.keyword> LANGUAGE_SYM 520 /* SQL-2003-R */
822 %token<lexer.keyword> LAST_SYM 521 /* SQL-2003-N */
823 %token LE 522 /* OPERATOR */
824 %token LEADING 523 /* SQL-2003-R */
825 %token<lexer.keyword> LEAVES 524
826 %token LEAVE_SYM 525
827 %token LEFT 526 /* SQL-2003-R */
828 %token<lexer.keyword> LESS_SYM 527
829 %token<lexer.keyword> LEVEL_SYM 528
830 %token LEX_HOSTNAME 529
831 %token LIKE 530 /* SQL-2003-R */
832 %token LIMIT 531
833 %token LINEAR_SYM 532
834 %token LINES 533
835 %token<lexer.keyword> LINESTRING_SYM 534 /* MYSQL */
836 %token<lexer.keyword> LIST_SYM 535
837 %token LOAD 536
838 %token<lexer.keyword> LOCAL_SYM 537 /* SQL-2003-R */
839 %token OBSOLETE_TOKEN_538 538 /* was: LOCATOR_SYM */
840 %token<lexer.keyword> LOCKS_SYM 539
841 %token LOCK_SYM 540
842 %token<lexer.keyword> LOGFILE_SYM 541
843 %token<lexer.keyword> LOGS_SYM 542
844 %token LONGBLOB_SYM 543 /* MYSQL */
845 %token LONGTEXT_SYM 544 /* MYSQL */
846 %token LONG_NUM 545
847 %token LONG_SYM 546
848 %token LOOP_SYM 547
849 %token LOW_PRIORITY 548
850 %token LT 549 /* OPERATOR */
851 %token<lexer.keyword> MASTER_AUTO_POSITION_SYM 550
852 %token MASTER_BIND_SYM 551
853 %token<lexer.keyword> MASTER_CONNECT_RETRY_SYM 552
854 %token<lexer.keyword> MASTER_DELAY_SYM 553
855 %token<lexer.keyword> MASTER_HOST_SYM 554
856 %token<lexer.keyword> MASTER_LOG_FILE_SYM 555
857 %token<lexer.keyword> MASTER_LOG_POS_SYM 556
858 %token<lexer.keyword> MASTER_PASSWORD_SYM 557
859 %token<lexer.keyword> MASTER_PORT_SYM 558
860 %token<lexer.keyword> MASTER_RETRY_COUNT_SYM 559
861 /* %token<lexer.keyword> MASTER_SERVER_ID_SYM 560 */ /* UNUSED */
862 %token<lexer.keyword> MASTER_SSL_CAPATH_SYM 561
863 %token<lexer.keyword> MASTER_TLS_VERSION_SYM 562
864 %token<lexer.keyword> MASTER_SSL_CA_SYM 563
865 %token<lexer.keyword> MASTER_SSL_CERT_SYM 564
866 %token<lexer.keyword> MASTER_SSL_CIPHER_SYM 565
867 %token<lexer.keyword> MASTER_SSL_CRL_SYM 566
868 %token<lexer.keyword> MASTER_SSL_CRLPATH_SYM 567
869 %token<lexer.keyword> MASTER_SSL_KEY_SYM 568
870 %token<lexer.keyword> MASTER_SSL_SYM 569
871 %token MASTER_SSL_VERIFY_SERVER_CERT_SYM 570
872 %token<lexer.keyword> MASTER_SYM 571
873 %token<lexer.keyword> MASTER_USER_SYM 572
874 %token<lexer.keyword> MASTER_HEARTBEAT_PERIOD_SYM 573
875 %token MATCH 574 /* SQL-2003-R */
876 %token<lexer.keyword> MAX_CONNECTIONS_PER_HOUR 575
877 %token<lexer.keyword> MAX_QUERIES_PER_HOUR 576
878 %token<lexer.keyword> MAX_ROWS 577
879 %token<lexer.keyword> MAX_SIZE_SYM 578
880 %token MAX_SYM 579 /* SQL-2003-N */
881 %token<lexer.keyword> MAX_UPDATES_PER_HOUR 580
882 %token<lexer.keyword> MAX_USER_CONNECTIONS_SYM 581
883 %token MAX_VALUE_SYM 582 /* SQL-2003-N */
884 %token MEDIUMBLOB_SYM 583 /* MYSQL */
885 %token MEDIUMINT_SYM 584 /* MYSQL */
886 %token MEDIUMTEXT_SYM 585 /* MYSQL */
887 %token<lexer.keyword> MEDIUM_SYM 586
888 %token<lexer.keyword> MEMORY_SYM 587
889 %token<lexer.keyword> MERGE_SYM 588 /* SQL-2003-R */
890 %token<lexer.keyword> MESSAGE_TEXT_SYM 589 /* SQL-2003-N */
891 %token<lexer.keyword> MICROSECOND_SYM 590 /* MYSQL-FUNC */
892 %token<lexer.keyword> MIGRATE_SYM 591
893 %token MINUTE_MICROSECOND_SYM 592
894 %token MINUTE_SECOND_SYM 593
895 %token<lexer.keyword> MINUTE_SYM 594 /* SQL-2003-R */
896 %token<lexer.keyword> MIN_ROWS 595
897 %token MIN_SYM 596 /* SQL-2003-N */
898 %token<lexer.keyword> MODE_SYM 597
899 %token MODIFIES_SYM 598 /* SQL-2003-R */
900 %token<lexer.keyword> MODIFY_SYM 599
901 %token MOD_SYM 600 /* SQL-2003-N */
902 %token<lexer.keyword> MONTH_SYM 601 /* SQL-2003-R */
903 %token<lexer.keyword> MULTILINESTRING_SYM 602 /* MYSQL */
904 %token<lexer.keyword> MULTIPOINT_SYM 603 /* MYSQL */
905 %token<lexer.keyword> MULTIPOLYGON_SYM 604 /* MYSQL */
906 %token<lexer.keyword> MUTEX_SYM 605
907 %token<lexer.keyword> MYSQL_ERRNO_SYM 606
908 %token<lexer.keyword> NAMES_SYM 607 /* SQL-2003-N */
909 %token<lexer.keyword> NAME_SYM 608 /* SQL-2003-N */
910 %token<lexer.keyword> NATIONAL_SYM 609 /* SQL-2003-R */
911 %token NATURAL 610 /* SQL-2003-R */
912 %token NCHAR_STRING 611
913 %token<lexer.keyword> NCHAR_SYM 612 /* SQL-2003-R */
914 %token<lexer.keyword> NDBCLUSTER_SYM 613
915 %token NE 614 /* OPERATOR */
916 %token NEG 615
917 %token<lexer.keyword> NEVER_SYM 616
918 %token<lexer.keyword> NEW_SYM 617 /* SQL-2003-R */
919 %token<lexer.keyword> NEXT_SYM 618 /* SQL-2003-N */
920 %token<lexer.keyword> NODEGROUP_SYM 619
921 %token<lexer.keyword> NONE_SYM 620 /* SQL-2003-R */
922 %token NOT2_SYM 621
923 %token NOT_SYM 622 /* SQL-2003-R */
924 %token NOW_SYM 623
925 %token<lexer.keyword> NO_SYM 624 /* SQL-2003-R */
926 %token<lexer.keyword> NO_WAIT_SYM 625
927 %token NO_WRITE_TO_BINLOG 626
928 %token NULL_SYM 627 /* SQL-2003-R */
929 %token NUM 628
930 %token<lexer.keyword> NUMBER_SYM 629 /* SQL-2003-N */
931 %token NUMERIC_SYM 630 /* SQL-2003-R */
932 %token<lexer.keyword> NVARCHAR_SYM 631
933 %token<lexer.keyword> OFFSET_SYM 632
934 %token ON_SYM 633 /* SQL-2003-R */
935 %token<lexer.keyword> ONE_SYM 634
936 %token<lexer.keyword> ONLY_SYM 635 /* SQL-2003-R */
937 %token<lexer.keyword> OPEN_SYM 636 /* SQL-2003-R */
938 %token OPTIMIZE 637
939 %token OPTIMIZER_COSTS_SYM 638
940 %token<lexer.keyword> OPTIONS_SYM 639
941 %token OPTION 640 /* SQL-2003-N */
942 %token OPTIONALLY 641
943 %token OR2_SYM 642
944 %token ORDER_SYM 643 /* SQL-2003-R */
945 %token OR_OR_SYM 644 /* OPERATOR */
946 %token OR_SYM 645 /* SQL-2003-R */
947 %token OUTER_SYM 646
948 %token OUTFILE 647
949 %token OUT_SYM 648 /* SQL-2003-R */
950 %token<lexer.keyword> OWNER_SYM 649
951 %token<lexer.keyword> PACK_KEYS_SYM 650
952 %token<lexer.keyword> PAGE_SYM 651
953 %token PARAM_MARKER 652
954 %token<lexer.keyword> PARSER_SYM 653
955 %token OBSOLETE_TOKEN_654 654 /* was: PARSE_GCOL_EXPR_SYM */
956 %token<lexer.keyword> PARTIAL 655 /* SQL-2003-N */
957 %token PARTITION_SYM 656 /* SQL-2003-R */
958 %token<lexer.keyword> PARTITIONS_SYM 657
959 %token<lexer.keyword> PARTITIONING_SYM 658
960 %token<lexer.keyword> PASSWORD 659
961 %token<lexer.keyword> PHASE_SYM 660
962 %token<lexer.keyword> PLUGIN_DIR_SYM 661 /* INTERNAL */
963 %token<lexer.keyword> PLUGIN_SYM 662
964 %token<lexer.keyword> PLUGINS_SYM 663
965 %token<lexer.keyword> POINT_SYM 664
966 %token<lexer.keyword> POLYGON_SYM 665 /* MYSQL */
967 %token<lexer.keyword> PORT_SYM 666
968 %token POSITION_SYM 667 /* SQL-2003-N */
969 %token<lexer.keyword> PRECEDES_SYM 668 /* MYSQL */
970 %token PRECISION 669 /* SQL-2003-R */
971 %token<lexer.keyword> PREPARE_SYM 670 /* SQL-2003-R */
972 %token<lexer.keyword> PRESERVE_SYM 671
973 %token<lexer.keyword> PREV_SYM 672
974 %token PRIMARY_SYM 673 /* SQL-2003-R */
975 %token<lexer.keyword> PRIVILEGES 674 /* SQL-2003-N */
976 %token PROCEDURE_SYM 675 /* SQL-2003-R */
977 %token<lexer.keyword> PROCESS 676
978 %token<lexer.keyword> PROCESSLIST_SYM 677
979 %token<lexer.keyword> PROFILE_SYM 678
980 %token<lexer.keyword> PROFILES_SYM 679
981 %token<lexer.keyword> PROXY_SYM 680
982 %token PURGE 681
983 %token<lexer.keyword> QUARTER_SYM 682
984 %token<lexer.keyword> QUERY_SYM 683
985 %token<lexer.keyword> QUICK 684
986 %token RANGE_SYM 685 /* SQL-2003-R */
987 %token READS_SYM 686 /* SQL-2003-R */
988 %token<lexer.keyword> READ_ONLY_SYM 687
989 %token READ_SYM 688 /* SQL-2003-N */
990 %token READ_WRITE_SYM 689
991 %token REAL_SYM 690 /* SQL-2003-R */
992 %token<lexer.keyword> REBUILD_SYM 691
993 %token<lexer.keyword> RECOVER_SYM 692
994 %token OBSOLETE_TOKEN_693 693 /* was: REDOFILE_SYM */
995 %token<lexer.keyword> REDO_BUFFER_SIZE_SYM 694
996 %token<lexer.keyword> REDUNDANT_SYM 695
997 %token REFERENCES 696 /* SQL-2003-R */
998 %token REGEXP 697
999 %token<lexer.keyword> RELAY 698
1000 %token<lexer.keyword> RELAYLOG_SYM 699
1001 %token<lexer.keyword> RELAY_LOG_FILE_SYM 700
1002 %token<lexer.keyword> RELAY_LOG_POS_SYM 701
1003 %token<lexer.keyword> RELAY_THREAD 702
1004 %token RELEASE_SYM 703 /* SQL-2003-R */
1005 %token<lexer.keyword> RELOAD 704
1006 %token<lexer.keyword> REMOVE_SYM 705
1007 %token RENAME 706
1008 %token<lexer.keyword> REORGANIZE_SYM 707
1009 %token<lexer.keyword> REPAIR 708
1010 %token<lexer.keyword> REPEATABLE_SYM 709 /* SQL-2003-N */
1011 %token REPEAT_SYM 710 /* MYSQL-FUNC */
1012 %token REPLACE_SYM 711 /* MYSQL-FUNC */
1013 %token<lexer.keyword> REPLICATION 712
1014 %token<lexer.keyword> REPLICATE_DO_DB 713
1015 %token<lexer.keyword> REPLICATE_IGNORE_DB 714
1016 %token<lexer.keyword> REPLICATE_DO_TABLE 715
1017 %token<lexer.keyword> REPLICATE_IGNORE_TABLE 716
1018 %token<lexer.keyword> REPLICATE_WILD_DO_TABLE 717
1019 %token<lexer.keyword> REPLICATE_WILD_IGNORE_TABLE 718
1020 %token<lexer.keyword> REPLICATE_REWRITE_DB 719
1021 %token REQUIRE_SYM 720
1022 %token<lexer.keyword> RESET_SYM 721
1023 %token RESIGNAL_SYM 722 /* SQL-2003-R */
1024 %token<lexer.keyword> RESOURCES 723
1025 %token<lexer.keyword> RESTORE_SYM 724
1026 %token RESTRICT 725
1027 %token<lexer.keyword> RESUME_SYM 726
1028 %token<lexer.keyword> RETURNED_SQLSTATE_SYM 727 /* SQL-2003-N */
1029 %token<lexer.keyword> RETURNS_SYM 728 /* SQL-2003-R */
1030 %token RETURN_SYM 729 /* SQL-2003-R */
1031 %token<lexer.keyword> REVERSE_SYM 730
1032 %token REVOKE 731 /* SQL-2003-R */
1033 %token RIGHT 732 /* SQL-2003-R */
1034 %token<lexer.keyword> ROLLBACK_SYM 733 /* SQL-2003-R */
1035 %token<lexer.keyword> ROLLUP_SYM 734 /* SQL-2003-R */
1036 %token<lexer.keyword> ROTATE_SYM 735
1037 %token<lexer.keyword> ROUTINE_SYM 736 /* SQL-2003-N */
1038 %token ROWS_SYM 737 /* SQL-2003-R */
1039 %token<lexer.keyword> ROW_FORMAT_SYM 738
1040 %token ROW_SYM 739 /* SQL-2003-R */
1041 %token<lexer.keyword> ROW_COUNT_SYM 740 /* SQL-2003-N */
1042 %token<lexer.keyword> RTREE_SYM 741
1043 %token<lexer.keyword> SAVEPOINT_SYM 742 /* SQL-2003-R */
1044 %token<lexer.keyword> SCHEDULE_SYM 743
1045 %token<lexer.keyword> SCHEMA_NAME_SYM 744 /* SQL-2003-N */
1046 %token SECOND_MICROSECOND_SYM 745
1047 %token<lexer.keyword> SECOND_SYM 746 /* SQL-2003-R */
1048 %token<lexer.keyword> SECURITY_SYM 747 /* SQL-2003-N */
1049 %token SELECT_SYM 748 /* SQL-2003-R */
1050 %token SENSITIVE_SYM 749 /* FUTURE-USE */
1051 %token SEPARATOR_SYM 750
1052 %token<lexer.keyword> SERIALIZABLE_SYM 751 /* SQL-2003-N */
1053 %token<lexer.keyword> SERIAL_SYM 752
1054 %token<lexer.keyword> SESSION_SYM 753 /* SQL-2003-N */
1055 %token<lexer.keyword> SERVER_SYM 754
1056 %token OBSOLETE_TOKEN_755 755 /* was: SERVER_OPTIONS */
1057 %token SET_SYM 756 /* SQL-2003-R */
1058 %token SET_VAR 757
1059 %token<lexer.keyword> SHARE_SYM 758
1060 %token SHIFT_LEFT 759 /* OPERATOR */
1061 %token SHIFT_RIGHT 760 /* OPERATOR */
1062 %token SHOW 761
1063 %token<lexer.keyword> SHUTDOWN 762
1064 %token SIGNAL_SYM 763 /* SQL-2003-R */
1065 %token<lexer.keyword> SIGNED_SYM 764
1066 %token<lexer.keyword> SIMPLE_SYM 765 /* SQL-2003-N */
1067 %token<lexer.keyword> SLAVE 766
1068 %token<lexer.keyword> SLOW 767
1069 %token SMALLINT_SYM 768 /* SQL-2003-R */
1070 %token<lexer.keyword> SNAPSHOT_SYM 769
1071 %token<lexer.keyword> SOCKET_SYM 770
1072 %token<lexer.keyword> SONAME_SYM 771
1073 %token<lexer.keyword> SOUNDS_SYM 772
1074 %token<lexer.keyword> SOURCE_SYM 773
1075 %token SPATIAL_SYM 774
1076 %token SPECIFIC_SYM 775 /* SQL-2003-R */
1077 %token SQLEXCEPTION_SYM 776 /* SQL-2003-R */
1078 %token SQLSTATE_SYM 777 /* SQL-2003-R */
1079 %token SQLWARNING_SYM 778 /* SQL-2003-R */
1080 %token<lexer.keyword> SQL_AFTER_GTIDS 779 /* MYSQL */
1081 %token<lexer.keyword> SQL_AFTER_MTS_GAPS 780 /* MYSQL */
1082 %token<lexer.keyword> SQL_BEFORE_GTIDS 781 /* MYSQL */
1083 %token SQL_BIG_RESULT 782
1084 %token<lexer.keyword> SQL_BUFFER_RESULT 783
1085 %token OBSOLETE_TOKEN_784 784 /* was: SQL_CACHE_SYM */
1086 %token SQL_CALC_FOUND_ROWS 785
1087 %token<lexer.keyword> SQL_NO_CACHE_SYM 786
1088 %token SQL_SMALL_RESULT 787
1089 %token SQL_SYM 788 /* SQL-2003-R */
1090 %token<lexer.keyword> SQL_THREAD 789
1091 %token SSL_SYM 790
1092 %token<lexer.keyword> STACKED_SYM 791 /* SQL-2003-N */
1093 %token STARTING 792
1094 %token<lexer.keyword> STARTS_SYM 793
1095 %token<lexer.keyword> START_SYM 794 /* SQL-2003-R */
1096 %token<lexer.keyword> STATS_AUTO_RECALC_SYM 795
1097 %token<lexer.keyword> STATS_PERSISTENT_SYM 796
1098 %token<lexer.keyword> STATS_SAMPLE_PAGES_SYM 797
1099 %token<lexer.keyword> STATUS_SYM 798
1100 %token STDDEV_SAMP_SYM 799 /* SQL-2003-N */
1101 %token STD_SYM 800
1102 %token<lexer.keyword> STOP_SYM 801
1103 %token<lexer.keyword> STORAGE_SYM 802
1104 %token STORED_SYM 803
1105 %token STRAIGHT_JOIN 804
1106 %token<lexer.keyword> STRING_SYM 805
1107 %token<lexer.keyword> SUBCLASS_ORIGIN_SYM 806 /* SQL-2003-N */
1108 %token<lexer.keyword> SUBDATE_SYM 807
1109 %token<lexer.keyword> SUBJECT_SYM 808
1110 %token<lexer.keyword> SUBPARTITIONS_SYM 809
1111 %token<lexer.keyword> SUBPARTITION_SYM 810
1112 %token SUBSTRING 811 /* SQL-2003-N */
1113 %token SUM_SYM 812 /* SQL-2003-N */
1114 %token<lexer.keyword> SUPER_SYM 813
1115 %token<lexer.keyword> SUSPEND_SYM 814
1116 %token<lexer.keyword> SWAPS_SYM 815
1117 %token<lexer.keyword> SWITCHES_SYM 816
1118 %token SYSDATE 817
1119 %token<lexer.keyword> TABLES 818
1120 %token<lexer.keyword> TABLESPACE_SYM 819
1121 %token OBSOLETE_TOKEN_820 820 /* was: TABLE_REF_PRIORITY */
1122 %token TABLE_SYM 821 /* SQL-2003-R */
1123 %token<lexer.keyword> TABLE_CHECKSUM_SYM 822
1124 %token<lexer.keyword> TABLE_NAME_SYM 823 /* SQL-2003-N */
1125 %token<lexer.keyword> TEMPORARY 824 /* SQL-2003-N */
1126 %token<lexer.keyword> TEMPTABLE_SYM 825
1127 %token TERMINATED 826
1128 %token TEXT_STRING 827
1129 %token<lexer.keyword> TEXT_SYM 828
1130 %token<lexer.keyword> THAN_SYM 829
1131 %token THEN_SYM 830 /* SQL-2003-R */
1132 %token<lexer.keyword> TIMESTAMP_SYM 831 /* SQL-2003-R */
1133 %token<lexer.keyword> TIMESTAMP_ADD 832
1134 %token<lexer.keyword> TIMESTAMP_DIFF 833
1135 %token<lexer.keyword> TIME_SYM 834 /* SQL-2003-R */
1136 %token TINYBLOB_SYM 835 /* MYSQL */
1137 %token TINYINT_SYM 836 /* MYSQL */
1138 %token TINYTEXT_SYN 837 /* MYSQL */
1139 %token TO_SYM 838 /* SQL-2003-R */
1140 %token TRAILING 839 /* SQL-2003-R */
1141 %token<lexer.keyword> TRANSACTION_SYM 840
1142 %token<lexer.keyword> TRIGGERS_SYM 841
1143 %token TRIGGER_SYM 842 /* SQL-2003-R */
1144 %token TRIM 843 /* SQL-2003-N */
1145 %token TRUE_SYM 844 /* SQL-2003-R */
1146 %token<lexer.keyword> TRUNCATE_SYM 845
1147 %token<lexer.keyword> TYPES_SYM 846
1148 %token<lexer.keyword> TYPE_SYM 847 /* SQL-2003-N */
1149 %token OBSOLETE_TOKEN_848 848 /* was: UDF_RETURNS_SYM */
1150 %token ULONGLONG_NUM 849
1151 %token<lexer.keyword> UNCOMMITTED_SYM 850 /* SQL-2003-N */
1152 %token<lexer.keyword> UNDEFINED_SYM 851
1153 %token UNDERSCORE_CHARSET 852
1154 %token<lexer.keyword> UNDOFILE_SYM 853
1155 %token<lexer.keyword> UNDO_BUFFER_SIZE_SYM 854
1156 %token UNDO_SYM 855 /* FUTURE-USE */
1157 %token<lexer.keyword> UNICODE_SYM 856
1158 %token<lexer.keyword> UNINSTALL_SYM 857
1159 %token UNION_SYM 858 /* SQL-2003-R */
1160 %token UNIQUE_SYM 859
1161 %token<lexer.keyword> UNKNOWN_SYM 860 /* SQL-2003-R */
1162 %token UNLOCK_SYM 861
1163 %token UNSIGNED_SYM 862 /* MYSQL */
1164 %token<lexer.keyword> UNTIL_SYM 863
1165 %token UPDATE_SYM 864 /* SQL-2003-R */
1166 %token<lexer.keyword> UPGRADE_SYM 865
1167 %token USAGE 866 /* SQL-2003-N */
1168 %token<lexer.keyword> USER 867 /* SQL-2003-R */
1169 %token<lexer.keyword> USE_FRM 868
1170 %token USE_SYM 869
1171 %token USING 870 /* SQL-2003-R */
1172 %token UTC_DATE_SYM 871
1173 %token UTC_TIMESTAMP_SYM 872
1174 %token UTC_TIME_SYM 873
1175 %token<lexer.keyword> VALIDATION_SYM 874 /* MYSQL */
1176 %token VALUES 875 /* SQL-2003-R */
1177 %token<lexer.keyword> VALUE_SYM 876 /* SQL-2003-R */
1178 %token VARBINARY_SYM 877 /* SQL-2008-R */
1179 %token VARCHAR_SYM 878 /* SQL-2003-R */
1180 %token<lexer.keyword> VARIABLES 879
1181 %token VARIANCE_SYM 880
1182 %token VARYING 881 /* SQL-2003-R */
1183 %token VAR_SAMP_SYM 882
1184 %token<lexer.keyword> VIEW_SYM 883 /* SQL-2003-N */
1185 %token VIRTUAL_SYM 884
1186 %token<lexer.keyword> WAIT_SYM 885
1187 %token<lexer.keyword> WARNINGS 886
1188 %token<lexer.keyword> WEEK_SYM 887
1189 %token<lexer.keyword> WEIGHT_STRING_SYM 888
1190 %token WHEN_SYM 889 /* SQL-2003-R */
1191 %token WHERE 890 /* SQL-2003-R */
1192 %token WHILE_SYM 891
1193 %token WITH 892 /* SQL-2003-R */
1194 %token OBSOLETE_TOKEN_893 893 /* was: WITH_CUBE_SYM */
1195 %token WITH_ROLLUP_SYM 894 /* INTERNAL */
1196 %token<lexer.keyword> WITHOUT_SYM 895 /* SQL-2003-R */
1197 %token<lexer.keyword> WORK_SYM 896 /* SQL-2003-N */
1198 %token<lexer.keyword> WRAPPER_SYM 897
1199 %token WRITE_SYM 898 /* SQL-2003-N */
1200 %token<lexer.keyword> X509_SYM 899
1201 %token<lexer.keyword> XA_SYM 900
1202 %token<lexer.keyword> XID_SYM 901 /* MYSQL */
1203 %token<lexer.keyword> XML_SYM 902
1204 %token XOR 903
1205 %token YEAR_MONTH_SYM 904
1206 %token<lexer.keyword> YEAR_SYM 905 /* SQL-2003-R */
1207 %token ZEROFILL_SYM 906 /* MYSQL */
1208
1209 /*
1210 Tokens from MySQL 8.0
1211 */
1212 %token JSON_UNQUOTED_SEPARATOR_SYM 907 /* MYSQL */
1213 %token<lexer.keyword> PERSIST_SYM 908 /* MYSQL */
1214 %token<lexer.keyword> ROLE_SYM 909 /* SQL-1999-R */
1215 %token<lexer.keyword> ADMIN_SYM 910 /* SQL-2003-N */
1216 %token<lexer.keyword> INVISIBLE_SYM 911
1217 %token<lexer.keyword> VISIBLE_SYM 912
1218 %token EXCEPT_SYM 913 /* SQL-1999-R */
1219 %token<lexer.keyword> COMPONENT_SYM 914 /* MYSQL */
1220 %token RECURSIVE_SYM 915 /* SQL-1999-R */
1221 %token GRAMMAR_SELECTOR_EXPR 916 /* synthetic token: starts single expr. */
1222 %token GRAMMAR_SELECTOR_GCOL 917 /* synthetic token: starts generated col. */
1223 %token GRAMMAR_SELECTOR_PART 918 /* synthetic token: starts partition expr. */
1224 %token GRAMMAR_SELECTOR_CTE 919 /* synthetic token: starts CTE expr. */
1225 %token JSON_OBJECTAGG 920 /* SQL-2015-R */
1226 %token JSON_ARRAYAGG 921 /* SQL-2015-R */
1227 %token OF_SYM 922 /* SQL-1999-R */
1228 %token<lexer.keyword> SKIP_SYM 923 /* MYSQL */
1229 %token<lexer.keyword> LOCKED_SYM 924 /* MYSQL */
1230 %token<lexer.keyword> NOWAIT_SYM 925 /* MYSQL */
1231 %token GROUPING_SYM 926 /* SQL-2011-R */
1232 %token<lexer.keyword> PERSIST_ONLY_SYM 927 /* MYSQL */
1233 %token<lexer.keyword> HISTOGRAM_SYM 928 /* MYSQL */
1234 %token<lexer.keyword> BUCKETS_SYM 929 /* MYSQL */
1235 %token<lexer.keyword> OBSOLETE_TOKEN_930 930 /* was: REMOTE_SYM */
1236 %token<lexer.keyword> CLONE_SYM 931 /* MYSQL */
1237 %token CUME_DIST_SYM 932 /* SQL-2003-R */
1238 %token DENSE_RANK_SYM 933 /* SQL-2003-R */
1239 %token<lexer.keyword> EXCLUDE_SYM 934 /* SQL-2003-N */
1240 %token FIRST_VALUE_SYM 935 /* SQL-2011-R */
1241 %token<lexer.keyword> FOLLOWING_SYM 936 /* SQL-2003-N */
1242 %token GROUPS_SYM 937 /* SQL-2011-R */
1243 %token LAG_SYM 938 /* SQL-2011-R */
1244 %token LAST_VALUE_SYM 939 /* SQL-2011-R */
1245 %token LEAD_SYM 940 /* SQL-2011-R */
1246 %token NTH_VALUE_SYM 941 /* SQL-2011-R */
1247 %token NTILE_SYM 942 /* SQL-2011-R */
1248 %token<lexer.keyword> NULLS_SYM 943 /* SQL-2003-N */
1249 %token<lexer.keyword> OTHERS_SYM 944 /* SQL-2003-N */
1250 %token OVER_SYM 945 /* SQL-2003-R */
1251 %token PERCENT_RANK_SYM 946 /* SQL-2003-R */
1252 %token<lexer.keyword> PRECEDING_SYM 947 /* SQL-2003-N */
1253 %token RANK_SYM 948 /* SQL-2003-R */
1254 %token<lexer.keyword> RESPECT_SYM 949 /* SQL_2011-N */
1255 %token ROW_NUMBER_SYM 950 /* SQL-2003-R */
1256 %token<lexer.keyword> TIES_SYM 951 /* SQL-2003-N */
1257 %token<lexer.keyword> UNBOUNDED_SYM 952 /* SQL-2003-N */
1258 %token WINDOW_SYM 953 /* SQL-2003-R */
1259 %token EMPTY_SYM 954 /* SQL-2016-R */
1260 %token JSON_TABLE_SYM 955 /* SQL-2016-R */
1261 %token<lexer.keyword> NESTED_SYM 956 /* SQL-2016-N */
1262 %token<lexer.keyword> ORDINALITY_SYM 957 /* SQL-2003-N */
1263 %token<lexer.keyword> PATH_SYM 958 /* SQL-2003-N */
1264 %token<lexer.keyword> HISTORY_SYM 959 /* MYSQL */
1265 %token<lexer.keyword> REUSE_SYM 960 /* MYSQL */
1266 %token<lexer.keyword> SRID_SYM 961 /* MYSQL */
1267 %token<lexer.keyword> THREAD_PRIORITY_SYM 962 /* MYSQL */
1268 %token<lexer.keyword> RESOURCE_SYM 963 /* MYSQL */
1269 %token SYSTEM_SYM 964 /* SQL-2003-R */
1270 %token<lexer.keyword> VCPU_SYM 965 /* MYSQL */
1271 %token<lexer.keyword> MASTER_PUBLIC_KEY_PATH_SYM 966 /* MYSQL */
1272 %token<lexer.keyword> GET_MASTER_PUBLIC_KEY_SYM 967 /* MYSQL */
1273 %token<lexer.keyword> RESTART_SYM 968 /* SQL-2003-N */
1274 %token<lexer.keyword> DEFINITION_SYM 969 /* MYSQL */
1275 %token<lexer.keyword> DESCRIPTION_SYM 970 /* MYSQL */
1276 %token<lexer.keyword> ORGANIZATION_SYM 971 /* MYSQL */
1277 %token<lexer.keyword> REFERENCE_SYM 972 /* MYSQL */
1278 %token<lexer.keyword> ACTIVE_SYM 973 /* MYSQL */
1279 %token<lexer.keyword> INACTIVE_SYM 974 /* MYSQL */
1280 %token LATERAL_SYM 975 /* SQL-1999-R */
1281 %token<lexer.keyword> ARRAY_SYM 976 /* SQL-2003-R */
1282 %token<lexer.keyword> MEMBER_SYM 977 /* SQL-2003-R */
1283 %token<lexer.keyword> OPTIONAL_SYM 978 /* MYSQL */
1284 %token<lexer.keyword> SECONDARY_SYM 979 /* MYSQL */
1285 %token<lexer.keyword> SECONDARY_ENGINE_SYM 980 /* MYSQL */
1286 %token<lexer.keyword> SECONDARY_LOAD_SYM 981 /* MYSQL */
1287 %token<lexer.keyword> SECONDARY_UNLOAD_SYM 982 /* MYSQL */
1288 %token<lexer.keyword> RETAIN_SYM 983 /* MYSQL */
1289 %token<lexer.keyword> OLD_SYM 984 /* SQL-2003-R */
1290 %token<lexer.keyword> ENFORCED_SYM 985 /* SQL-2015-N */
1291 %token<lexer.keyword> OJ_SYM 986 /* ODBC */
1292 %token<lexer.keyword> NETWORK_NAMESPACE_SYM 987 /* MYSQL */
1293 %token<lexer.keyword> RANDOM_SYM 988 /* MYSQL */
1294 %token<lexer.keyword> MASTER_COMPRESSION_ALGORITHM_SYM 989 /* MYSQL */
1295 %token<lexer.keyword> MASTER_ZSTD_COMPRESSION_LEVEL_SYM 990 /* MYSQL */
1296 %token<lexer.keyword> PRIVILEGE_CHECKS_USER_SYM 991 /* MYSQL */
1297 %token<lexer.keyword> MASTER_TLS_CIPHERSUITES_SYM 992 /* MYSQL */
1298 %token<lexer.keyword> REQUIRE_ROW_FORMAT_SYM 993 /* MYSQL */
1299 %token<lexer.keyword> PASSWORD_LOCK_TIME_SYM 994 /* MYSQL */
1300 %token<lexer.keyword> FAILED_LOGIN_ATTEMPTS_SYM 995 /* MYSQL */
1301 %token<lexer.keyword> REQUIRE_TABLE_PRIMARY_KEY_CHECK_SYM 996 /* MYSQL */
1302 %token<lexer.keyword> STREAM_SYM 997 /* MYSQL */
1303 %token<lexer.keyword> OFF_SYM 998 /* SQL-1999-R */
1304 %token<lexer.keyword> RETURNING_SYM 999 /* SQL-2016-N */
1305 /*
1306 Here is an intentional gap in token numbers.
1307
1308 Token numbers starting 1000 till YYUNDEF are occupied by:
1309 1. hint terminals (see sql_hints.yy),
1310 2. digest special internal token numbers (see gen_lex_token.cc, PART 6).
1311
1312 Note: YYUNDEF in internal to Bison. Please don't change its number, or change
1313 it in sync with YYUNDEF in sql_hints.yy.
1314 */
1315 %token YYUNDEF 1150 /* INTERNAL (for use in the lexer) */
1316 %token<lexer.keyword> JSON_VALUE_SYM 1151 /* SQL-2016-R */
1317 %token<lexer.keyword> TLS_SYM 1152 /* MYSQL */
1318 %token<lexer.keyword> ATTRIBUTE_SYM 1153 /* SQL-2003-N */
1319
1320 %token<lexer.keyword> ENGINE_ATTRIBUTE_SYM 1154 /* MYSQL */
1321 %token<lexer.keyword> SECONDARY_ENGINE_ATTRIBUTE_SYM 1155 /* MYSQL */
1322 %token<lexer.keyword> SOURCE_CONNECTION_AUTO_FAILOVER_SYM 1156 /* MYSQL */
1323 %token<lexer.keyword> ZONE_SYM 1157 /* SQL-2003-N */
1324 %token<lexer.keyword> GRAMMAR_SELECTOR_DERIVED_EXPR 1158 /* synthetic token:
1325 starts derived
1326 table expressions. */
1327 %token<lexer.keyword> REPLICA_SYM 1159
1328 %token<lexer.keyword> REPLICAS_SYM 1160
1329 %token<lexer.keyword> ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_SYM 1161 /* MYSQL */
1330 %token<lexer.keyword> GET_SOURCE_PUBLIC_KEY_SYM 1162 /* MYSQL */
1331 %token<lexer.keyword> SOURCE_AUTO_POSITION_SYM 1163 /* MYSQL */
1332 %token<lexer.keyword> SOURCE_BIND_SYM 1164 /* MYSQL */
1333 %token<lexer.keyword> SOURCE_COMPRESSION_ALGORITHM_SYM 1165 /* MYSQL */
1334 %token<lexer.keyword> SOURCE_CONNECT_RETRY_SYM 1166 /* MYSQL */
1335 %token<lexer.keyword> SOURCE_DELAY_SYM 1167 /* MYSQL */
1336 %token<lexer.keyword> SOURCE_HEARTBEAT_PERIOD_SYM 1168 /* MYSQL */
1337 %token<lexer.keyword> SOURCE_HOST_SYM 1169 /* MYSQL */
1338 %token<lexer.keyword> SOURCE_LOG_FILE_SYM 1170 /* MYSQL */
1339 %token<lexer.keyword> SOURCE_LOG_POS_SYM 1171 /* MYSQL */
1340 %token<lexer.keyword> SOURCE_PASSWORD_SYM 1172 /* MYSQL */
1341 %token<lexer.keyword> SOURCE_PORT_SYM 1173 /* MYSQL */
1342 %token<lexer.keyword> SOURCE_PUBLIC_KEY_PATH_SYM 1174 /* MYSQL */
1343 %token<lexer.keyword> SOURCE_RETRY_COUNT_SYM 1175 /* MYSQL */
1344 %token<lexer.keyword> SOURCE_SSL_SYM 1176 /* MYSQL */
1345 %token<lexer.keyword> SOURCE_SSL_CA_SYM 1177 /* MYSQL */
1346 %token<lexer.keyword> SOURCE_SSL_CAPATH_SYM 1178 /* MYSQL */
1347 %token<lexer.keyword> SOURCE_SSL_CERT_SYM 1179 /* MYSQL */
1348 %token<lexer.keyword> SOURCE_SSL_CIPHER_SYM 1180 /* MYSQL */
1349 %token<lexer.keyword> SOURCE_SSL_CRL_SYM 1181 /* MYSQL */
1350 %token<lexer.keyword> SOURCE_SSL_CRLPATH_SYM 1182 /* MYSQL */
1351 %token<lexer.keyword> SOURCE_SSL_KEY_SYM 1183 /* MYSQL */
1352 %token<lexer.keyword> SOURCE_SSL_VERIFY_SERVER_CERT_SYM 1184 /* MYSQL */
1353 %token<lexer.keyword> SOURCE_TLS_CIPHERSUITES_SYM 1185 /* MYSQL */
1354 %token<lexer.keyword> SOURCE_TLS_VERSION_SYM 1186 /* MYSQL */
1355 %token<lexer.keyword> SOURCE_USER_SYM 1187 /* MYSQL */
1356 %token<lexer.keyword> SOURCE_ZSTD_COMPRESSION_LEVEL_SYM 1188 /* MYSQL */
1357
1358 %token<lexer.keyword> ST_COLLECT_SYM 1189 /* MYSQL */
1359 %token<lexer.keyword> KEYRING_SYM 1190 /* MYSQL */
1360
1361 %token<lexer.keyword> AUTHENTICATION_SYM 1191 /* MYSQL */
1362 %token<lexer.keyword> FACTOR_SYM 1192 /* MYSQL */
1363 %token<lexer.keyword> FINISH_SYM 1193 /* SQL-2016-N */
1364 %token<lexer.keyword> INITIATE_SYM 1194 /* MYSQL */
1365 %token<lexer.keyword> REGISTRATION_SYM 1195 /* MYSQL */
1366 %token<lexer.keyword> UNREGISTER_SYM 1196 /* MYSQL */
1367 %token<lexer.keyword> INITIAL_SYM 1197 /* SQL-2016-R */
1368 %token<lexer.keyword> CHALLENGE_RESPONSE_SYM 1198 /* MYSQL */
1369
1370 %token<lexer.keyword> GTID_ONLY_SYM 1199 /* MYSQL */
1371
1372 /*
1373 Tokens from Percona Server 5.7 and older
1374 */
1375 %token<lexer.keyword> CLIENT_STATS_SYM 1301
1376 %token CLUSTERING_SYM 1302
1377 %token<lexer.keyword> COMPRESSION_DICTIONARY_SYM 1303
1378 %token<lexer.keyword> INDEX_STATS_SYM 1304
1379 %token<lexer.keyword> TABLE_STATS_SYM 1305
1380 %token<lexer.keyword> THREAD_STATS_SYM 1306
1381 %token<lexer.keyword> USER_STATS_SYM 1307
1382 %token<lexer.keyword> ENCRYPTION_KEY_ID_SYM 1308
1383
1384 /*
1385 Tokens from Percona Server 8.0
1386 */
1387 %token<lexer.keyword> EFFECTIVE_SYM 1350
1388 %token SEQUENCE_TABLE_SYM 1351
1389
1390 /*
1391 Precedence rules used to resolve the ambiguity when using keywords as idents
1392 in the case e.g.:
1393
1394 SELECT TIMESTAMP'...'
1395
1396 vs.
1397
1398 CREATE TABLE t1 ( timestamp INT );
1399
1400 The use as an ident is allowed, but must never take precedence over the use
1401 as an actual keyword. Hence we declare the fake token KEYWORD_USED_AS_IDENT
1402 to have the lowest possible precedence, KEYWORD_USED_AS_KEYWORD need only be
1403 a bit higher. The TEXT_STRING token is added here to resolve the ambiguity
1404 in the above example.
1405 */
1406 %left KEYWORD_USED_AS_IDENT
1407 %nonassoc TEXT_STRING
1408 %left KEYWORD_USED_AS_KEYWORD
1409
1410
1411 /*
1412 Resolve column attribute ambiguity -- force precedence of "UNIQUE KEY" against
1413 simple "UNIQUE" and "KEY" attributes:
1414 */
1415 %right UNIQUE_SYM KEY_SYM
1416
1417 %left CONDITIONLESS_JOIN
1418 %left JOIN_SYM INNER_SYM CROSS STRAIGHT_JOIN NATURAL LEFT RIGHT ON_SYM USING
1419 %left SET_VAR
1420 %left OR_SYM OR2_SYM
1421 %left XOR
1422 %left AND_SYM AND_AND_SYM
1423 %left BETWEEN_SYM CASE_SYM WHEN_SYM THEN_SYM ELSE
1424 %left EQ EQUAL_SYM GE GT_SYM LE LT NE IS LIKE REGEXP IN_SYM
1425 %left '|'
1426 %left '&'
1427 %left SHIFT_LEFT SHIFT_RIGHT
1428 %left '-' '+'
1429 %left '*' '/' '%' DIV_SYM MOD_SYM
1430 %left '^'
1431 %left OR_OR_SYM
1432 %left NEG '~'
1433 %right NOT_SYM NOT2_SYM
1434 %right BINARY_SYM COLLATE_SYM
1435 %left INTERVAL_SYM
1436 %left SUBQUERY_AS_EXPR
1437 %left '(' ')'
1438
1439 %left EMPTY_FROM_CLAUSE
1440 %right INTO
1441
1442 %type <lexer.lex_str>
1443 IDENT IDENT_QUOTED TEXT_STRING DECIMAL_NUM FLOAT_NUM NUM LONG_NUM HEX_NUM
1444 LEX_HOSTNAME ULONGLONG_NUM select_alias ident opt_ident ident_or_text
1445 role_ident role_ident_or_text
1446 IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
1447 NCHAR_STRING
1448 BIN_NUM TEXT_STRING_filesystem ident_or_empty
1449 TEXT_STRING_sys_nonewline TEXT_STRING_password TEXT_STRING_hash
1450 TEXT_STRING_validated
1451 filter_wild_db_table_string
1452 opt_constraint_name
1453 ts_datafile lg_undofile /*lg_redofile*/ opt_logfile_group_name opt_ts_datafile_name
1454 opt_describe_column
1455 opt_datadir_ssl default_encryption
1456 lvalue_ident
1457 schema
1458 engine_or_all
1459 opt_binlog_in
1460
1461 %type <lex_cstr>
1462 key_cache_name
1463 label_ident
1464 opt_table_alias
1465 opt_with_compression_dictionary
1466 opt_replace_password
1467 sp_opt_label
1468 json_attribute
1469 opt_channel
1470
1471 %type <lex_str_list> TEXT_STRING_sys_list
1472
1473 %type <table>
1474 table_ident
1475
1476 %type <simple_string>
1477 opt_db
1478
1479 %type <string>
1480 text_string opt_gconcat_separator
1481 opt_xml_rows_identified_by
1482
1483 %type <num>
1484 lock_option
1485 udf_type if_exists
1486 opt_no_write_to_binlog
1487 all_or_any opt_distinct
1488 fulltext_options union_option
1489 transaction_access_mode_types
1490 opt_natural_language_mode opt_query_expansion
1491 opt_ev_status opt_ev_on_completion ev_on_completion opt_ev_comment
1492 ev_alter_on_schedule_completion opt_ev_rename_to opt_ev_sql_stmt
1493 trg_action_time trg_event
1494 view_check_option
1495 signed_num
1496 opt_num_buckets
1497 opt_ignore_unknown_user
1498
1499
1500 %type <order_direction>
1501 ordering_direction opt_ordering_direction
1502
1503 /*
1504 Bit field of MYSQL_START_TRANS_OPT_* flags.
1505 */
1506 %type <num> opt_start_transaction_option_list
1507 %type <num> start_transaction_option_list
1508 %type <num> start_transaction_option
1509
1510 %type <m_yes_no_unk>
1511 opt_chain opt_release
1512
1513 %type <m_fk_option>
1514 delete_option
1515
1516 %type <ulong_num>
1517 ulong_num real_ulong_num merge_insert_types
1518 ws_num_codepoints func_datetime_precision
1519 now
1520 opt_checksum_type
1521 opt_ignore_lines
1522 opt_profile_defs
1523 profile_defs
1524 profile_def
1525 factor
1526
1527 %type <ulonglong_number>
1528 ulonglong_num real_ulonglong_num size_number
1529 option_autoextend_size
1530
1531 %type <lock_type>
1532 replace_lock_option opt_low_priority insert_lock_option load_data_lock
1533
1534 %type <locked_row_action> locked_row_action opt_locked_row_action
1535
1536 %type <item>
1537 literal insert_ident temporal_literal
1538 simple_ident expr opt_expr opt_else
1539 set_function_specification sum_expr
1540 in_sum_expr grouping_operation
1541 window_func_call opt_ll_default
1542 bool_pri
1543 predicate bit_expr
1544 table_wild simple_expr udf_expr
1545 expr_or_default set_expr_or_default
1546 geometry_function
1547 signed_literal now_or_signed_literal
1548 simple_ident_nospvar simple_ident_q
1549 field_or_var limit_option
1550 function_call_keyword
1551 function_call_nonkeyword
1552 function_call_generic
1553 function_call_conflict
1554 signal_allowed_expr
1555 simple_target_specification
1556 condition_number
1557 create_compression_dictionary_allowed_expr
1558 filter_db_ident
1559 filter_table_ident
1560 filter_string
1561 select_item
1562 opt_where_clause
1563 where_clause
1564 opt_having_clause
1565 opt_simple_limit
1566 null_as_literal
1567 literal_or_null
1568 signed_literal_or_null
1569 stable_integer
1570 param_or_var
1571 in_expression_user_variable_assignment
1572 rvalue_system_or_user_variable
1573
1574 %type <item_string> window_name opt_existing_window_name
1575
1576 %type <item_num> NUM_literal
1577 int64_literal
1578
1579 %type <item_list>
1580 when_list
1581 opt_filter_db_list filter_db_list
1582 opt_filter_table_list filter_table_list
1583 opt_filter_string_list filter_string_list
1584 opt_filter_db_pair_list filter_db_pair_list
1585
1586 %type <item_list2>
1587 expr_list udf_expr_list opt_udf_expr_list opt_expr_list select_item_list
1588 opt_paren_expr_list ident_list_arg ident_list values opt_values row_value fields
1589 fields_or_vars
1590 opt_field_or_var_spec
1591 row_value_explicit
1592
1593 %type <var_type>
1594 option_type opt_var_type opt_rvalue_system_variable_type opt_set_var_ident_type
1595
1596 %type <key_type>
1597 constraint_key_type opt_unique_combo_clustering unique_combo_clustering
1598
1599 %type <key_alg>
1600 index_type
1601
1602 %type <string_list>
1603 string_list using_list opt_use_partition use_partition ident_string_list
1604 all_or_alt_part_name_list
1605
1606 %type <key_part>
1607 key_part key_part_with_expression
1608
1609 %type <date_time_type> date_time_type;
1610 %type <interval> interval
1611
1612 %type <interval_time_st> interval_time_stamp
1613
1614 %type <row_type> row_types
1615
1616 %type <resource_group_type> resource_group_types
1617
1618 %type <resource_group_vcpu_list_type>
1619 opt_resource_group_vcpu_list
1620 vcpu_range_spec_list
1621
1622 %type <resource_group_priority_type> opt_resource_group_priority
1623
1624 %type <resource_group_state_type> opt_resource_group_enable_disable
1625
1626 %type <resource_group_flag_type> opt_force
1627
1628 %type <thread_id_list_type> thread_id_list thread_id_list_options
1629
1630 %type <vcpu_range_type> vcpu_num_or_range
1631
1632 %type <tx_isolation> isolation_types
1633
1634 %type <ha_rkey_mode> handler_rkey_mode
1635
1636 %type <ha_read_mode> handler_scan_function
1637 handler_rkey_function
1638
1639 %type <cast_type> cast_type opt_returning_type
1640
1641 %type <lexer.keyword> ident_keyword label_keyword role_keyword
1642 lvalue_keyword
1643 ident_keywords_unambiguous
1644 ident_keywords_ambiguous_1_roles_and_labels
1645 ident_keywords_ambiguous_2_labels
1646 ident_keywords_ambiguous_3_roles
1647 ident_keywords_ambiguous_4_system_variables
1648
1649 %type <lex_user> user_ident_or_text user create_user alter_user user_func role
1650
1651 %type <lex_mfa>
1652 identification
1653 identified_by_password
1654 identified_by_random_password
1655 identified_with_plugin
1656 identified_with_plugin_as_auth
1657 identified_with_plugin_by_random_password
1658 identified_with_plugin_by_password
1659 opt_initial_auth
1660 opt_user_registration
1661
1662 %type <lex_mfas> opt_create_user_with_mfa
1663
1664 %type <lexer.charset>
1665 opt_collate
1666 charset_name
1667 old_or_new_charset_name
1668 old_or_new_charset_name_or_default
1669 collation_name
1670 opt_load_data_charset
1671 UNDERSCORE_CHARSET
1672 ascii unicode
1673 default_charset default_collation
1674
1675 %type <boolfunc2creator> comp_op
1676
1677 %type <num> sp_decl_idents sp_opt_inout sp_handler_type sp_hcond_list
1678 %type <spcondvalue> sp_cond sp_hcond sqlstate signal_value opt_signal_value
1679 %type <spblock> sp_decls sp_decl
1680 %type <spname> sp_name
1681 %type <index_hint> index_hint_type
1682 %type <num> index_hint_clause
1683 %type <filetype> data_or_xml
1684
1685 %type <da_condition_item_name> signal_condition_information_item_name
1686
1687 %type <diag_area> which_area;
1688 %type <diag_info> diagnostics_information;
1689 %type <stmt_info_item> statement_information_item;
1690 %type <stmt_info_item_name> statement_information_item_name;
1691 %type <stmt_info_list> statement_information;
1692 %type <cond_info_item> condition_information_item;
1693 %type <cond_info_item_name> condition_information_item_name;
1694 %type <cond_info_list> condition_information;
1695 %type <signal_item_list> signal_information_item_list;
1696 %type <signal_item_list> opt_set_signal_information;
1697
1698 %type <trg_characteristics> trigger_follows_precedes_clause;
1699 %type <trigger_action_order_type> trigger_action_order;
1700
1701 %type <xid> xid;
1702 %type <xa_option_type> opt_join_or_resume;
1703 %type <xa_option_type> opt_suspend;
1704 %type <xa_option_type> opt_one_phase;
1705
1706 %type <is_not_empty> opt_convert_xid opt_ignore opt_linear opt_bin_mod
1707 opt_if_not_exists opt_temporary
1708 opt_grant_option opt_with_admin_option
1709 opt_full opt_extended
1710 opt_ignore_leaves
1711 opt_local
1712 opt_retain_current_password
1713 opt_discard_old_password
1714 opt_constraint_enforcement
1715 constraint_enforcement
1716 opt_not
1717 opt_interval
1718
1719 %type <show_cmd_type> opt_show_cmd_type
1720
1721 /*
1722 A bit field of SLAVE_IO, SLAVE_SQL flags.
1723 */
1724 %type <num> opt_replica_thread_option_list
1725 %type <num> replica_thread_option_list
1726 %type <num> replica_thread_option
1727
1728 %type <key_usage_element> key_usage_element
1729
1730 %type <key_usage_list> key_usage_list opt_key_usage_list index_hint_definition
1731 index_hints_list opt_index_hints_list opt_key_definition
1732 opt_cache_key_list
1733
1734 %type <order_expr> order_expr alter_order_item
1735 grouping_expr
1736
1737 %type <order_list> order_list group_list gorder_list opt_gorder_clause
1738 alter_order_list opt_partition_clause opt_window_order_by_clause
1739
1740 %type <c_str> field_length opt_field_length type_datetime_precision
1741 opt_place
1742
1743 %type <precision> precision opt_precision float_options standard_float_options
1744
1745 %type <charset_with_opt_binary> opt_charset_with_opt_binary
1746
1747 %type <limit_options> limit_options
1748
1749 %type <limit_clause> limit_clause opt_limit_clause
1750
1751 %type <ulonglong_number> query_spec_option
1752
1753 %type <select_options> select_option select_option_list select_options
1754
1755 %type <node>
1756 option_value
1757
1758 %type <join_table> joined_table joined_table_parens
1759
1760 %type <table_reference_list> opt_from_clause from_clause from_tables
1761 table_reference_list table_reference_list_parens explicit_table
1762
1763 %type <olap_type> olap_opt
1764
1765 %type <group> opt_group_clause
1766
1767 %type <windows> opt_window_clause ///< Definition of named windows
1768 ///< for the query specification
1769 window_definition_list
1770
1771 %type <window> window_definition window_spec window_spec_details window_name_or_spec
1772 windowing_clause ///< Definition of unnamed window near the window function.
1773 opt_windowing_clause ///< For functions which can be either set or window
1774 ///< functions (e.g. SUM), non-empty clause makes the difference.
1775
1776 %type <window_frame> opt_window_frame_clause
1777
1778 %type <frame_units> window_frame_units
1779
1780 %type <frame_extent> window_frame_extent window_frame_between
1781
1782 %type <bound> window_frame_start window_frame_bound
1783
1784 %type <frame_exclusion> opt_window_frame_exclusion
1785
1786 %type <null_treatment> opt_null_treatment
1787
1788 %type <lead_lag_info> opt_lead_lag_info
1789
1790 %type <from_first_last> opt_from_first_last
1791
1792 %type <order> order_clause opt_order_clause
1793
1794 %type <locking_clause> locking_clause
1795
1796 %type <locking_clause_list> locking_clause_list
1797
1798 %type <lock_strength> lock_strength
1799
1800 %type <table_reference> table_reference esc_table_reference
1801 table_factor single_table single_table_parens table_function
1802
1803 %type <query_expression_body> query_expression_body
1804
1805 %type <bipartite_name> lvalue_variable rvalue_system_variable
1806
1807 %type <option_value_following_option_type> option_value_following_option_type
1808
1809 %type <option_value_no_option_type> option_value_no_option_type
1810
1811 %type <option_value_list> option_value_list option_value_list_continued
1812
1813 %type <start_option_value_list> start_option_value_list
1814
1815 %type <transaction_access_mode> transaction_access_mode
1816 opt_transaction_access_mode
1817
1818 %type <isolation_level> isolation_level opt_isolation_level
1819
1820 %type <transaction_characteristics> transaction_characteristics
1821
1822 %type <start_option_value_list_following_option_type>
1823 start_option_value_list_following_option_type
1824
1825 %type <set> set
1826
1827 %type <line_separators> line_term line_term_list opt_line_term
1828
1829 %type <field_separators> field_term field_term_list opt_field_term
1830
1831 %type <into_destination> into_destination into_clause
1832
1833 %type <select_var_ident> select_var_ident
1834
1835 %type <select_var_list> select_var_list
1836
1837 %type <query_primary>
1838 as_create_query_expression
1839 query_expression_or_parens
1840 query_expression_parens
1841 query_primary
1842 query_specification
1843
1844 %type <query_expression> query_expression
1845
1846 %type <subquery> subquery row_subquery table_subquery
1847
1848 %type <derived_table> derived_table
1849
1850 %type <param_marker> param_marker
1851
1852 %type <text_literal> text_literal
1853
1854 %type <top_level_node>
1855 alter_instance_stmt
1856 alter_resource_group_stmt
1857 alter_table_stmt
1858 analyze_table_stmt
1859 call_stmt
1860 check_table_stmt
1861 create_index_stmt
1862 create_resource_group_stmt
1863 create_role_stmt
1864 create_srs_stmt
1865 create_table_stmt
1866 delete_stmt
1867 describe_stmt
1868 do_stmt
1869 drop_index_stmt
1870 drop_resource_group_stmt
1871 drop_role_stmt
1872 drop_srs_stmt
1873 explain_stmt
1874 explainable_stmt
1875 handler_stmt
1876 insert_stmt
1877 keycache_stmt
1878 load_stmt
1879 optimize_table_stmt
1880 preload_stmt
1881 repair_table_stmt
1882 replace_stmt
1883 restart_server_stmt
1884 select_stmt
1885 select_stmt_with_into
1886 set_resource_group_stmt
1887 set_role_stmt
1888 show_binary_logs_stmt
1889 show_binlog_events_stmt
1890 show_character_set_stmt
1891 show_collation_stmt
1892 show_columns_stmt
1893 show_count_errors_stmt
1894 show_count_warnings_stmt
1895 show_create_database_stmt
1896 show_create_event_stmt
1897 show_create_function_stmt
1898 show_create_procedure_stmt
1899 show_create_table_stmt
1900 show_create_trigger_stmt
1901 show_create_user_stmt
1902 show_create_view_stmt
1903 show_databases_stmt
1904 show_engine_logs_stmt
1905 show_engine_mutex_stmt
1906 show_engine_status_stmt
1907 show_engines_stmt
1908 show_errors_stmt
1909 show_events_stmt
1910 show_function_code_stmt
1911 show_function_status_stmt
1912 show_grants_stmt
1913 show_keys_stmt
1914 show_master_status_stmt
1915 show_open_tables_stmt
1916 show_plugins_stmt
1917 show_privileges_stmt
1918 show_procedure_code_stmt
1919 show_procedure_status_stmt
1920 show_processlist_stmt
1921 show_profile_stmt
1922 show_profiles_stmt
1923 show_relaylog_events_stmt
1924 show_replica_status_stmt
1925 show_replicas_stmt
1926 show_stats_stmt
1927 show_status_stmt
1928 show_table_status_stmt
1929 show_tables_stmt
1930 show_triggers_stmt
1931 show_variables_stmt
1932 show_warnings_stmt
1933 shutdown_stmt
1934 simple_statement
1935 truncate_stmt
1936 update_stmt
1937
1938 %type <table_ident> table_ident_opt_wild
1939
1940 %type <table_ident_list> table_alias_ref_list table_locking_list
1941
1942 %type <simple_ident_list> simple_ident_list opt_derived_column_list
1943
1944 %type <num> opt_delete_options
1945
1946 %type <opt_delete_option> opt_delete_option
1947
1948 %type <column_value_pair>
1949 update_elem
1950
1951 %type <column_value_list_pair>
1952 update_list
1953 opt_insert_update_list
1954
1955 %type <values_list> values_list insert_values table_value_constructor
1956 values_row_list
1957
1958 %type <insert_query_expression> insert_query_expression
1959
1960 %type <column_row_value_list_pair> insert_from_constructor
1961
1962 %type <lexer.optimizer_hints> SELECT_SYM INSERT_SYM REPLACE_SYM UPDATE_SYM DELETE_SYM
1963 OPTIMIZE CALL_SYM ALTER ANALYZE_SYM CHECK_SYM LOAD CREATE
1964
1965 %type <join_type> outer_join_type natural_join_type inner_join_type
1966
1967 %type <user_list> user_list role_list default_role_clause opt_except_role_list
1968
1969 %type <alter_instance_cmd> alter_instance_action
1970
1971 %type <index_column_list> key_list key_list_with_expression
1972
1973 %type <index_options> opt_index_options index_options opt_fulltext_index_options
1974 fulltext_index_options opt_spatial_index_options spatial_index_options
1975
1976 %type <opt_index_lock_and_algorithm> opt_index_lock_and_algorithm
1977
1978 %type <index_option> index_option common_index_option fulltext_index_option
1979 spatial_index_option
1980 index_type_clause
1981 opt_index_type_clause
1982
1983 %type <alter_table_algorithm> alter_algorithm_option_value
1984 alter_algorithm_option
1985
1986 %type <alter_table_lock> alter_lock_option_value alter_lock_option
1987
1988 %type <table_constraint_def> table_constraint_def
1989
1990 %type <index_name_and_type> opt_index_name_and_type
1991
1992 %type <visibility> visibility
1993
1994 %type <with_clause> with_clause opt_with_clause
1995 %type <with_list> with_list
1996 %type <common_table_expr> common_table_expr
1997
1998 %type <partition_option> part_option
1999
2000 %type <partition_option_list> opt_part_options part_option_list
2001
2002 %type <sub_part_definition> sub_part_definition
2003
2004 %type <sub_part_list> sub_part_list opt_sub_partition
2005
2006 %type <part_value_item> part_value_item
2007
2008 %type <part_value_item_list> part_value_item_list
2009
2010 %type <part_value_item_list_paren> part_value_item_list_paren part_func_max
2011
2012 %type <part_value_list> part_value_list
2013
2014 %type <part_values> part_values_in
2015
2016 %type <opt_part_values> opt_part_values
2017
2018 %type <part_definition> part_definition
2019
2020 %type <part_def_list> part_def_list opt_part_defs
2021
2022 %type <ulong_num> opt_num_subparts opt_num_parts
2023
2024 %type <name_list> name_list opt_name_list
2025
2026 %type <opt_key_algo> opt_key_algo
2027
2028 %type <opt_sub_part> opt_sub_part
2029
2030 %type <part_type_def> part_type_def
2031
2032 %type <partition_clause> partition_clause
2033
2034 %type <mi_type> mi_repair_type mi_repair_types opt_mi_repair_types
2035 mi_check_type mi_check_types opt_mi_check_types
2036
2037 %type <opt_restrict> opt_restrict;
2038
2039 %type <table_list> table_list opt_table_list
2040
2041 %type <ternary_option> ternary_option;
2042
2043 %type <create_table_option> create_table_option
2044
2045 %type <create_table_options> create_table_options
2046
2047 %type <space_separated_alter_table_opts> create_table_options_space_separated
2048
2049 %type <on_duplicate> duplicate opt_duplicate
2050
2051 %type <col_attr> column_attribute
2052
2053 %type <column_format> column_format
2054
2055 %type <storage_media> storage_media
2056
2057 %type <col_attr_list> column_attribute_list opt_column_attribute_list
2058
2059 %type <virtual_or_stored> opt_stored_attribute
2060
2061 %type <field_option> field_option field_opt_list field_options
2062
2063 %type <int_type> int_type
2064
2065 %type <type> spatial_type type
2066
2067 %type <numeric_type> real_type numeric_type
2068
2069 %type <sp_default> sp_opt_default
2070
2071 %type <field_def> field_def
2072
2073 %type <item> check_constraint
2074
2075 %type <table_constraint_def> opt_references
2076
2077 %type <fk_options> opt_on_update_delete
2078
2079 %type <opt_match_clause> opt_match_clause
2080
2081 %type <reference_list> reference_list opt_ref_list
2082
2083 %type <fk_references> references
2084
2085 %type <column_def> column_def
2086
2087 %type <table_element> table_element
2088
2089 %type <table_element_list> table_element_list
2090
2091 %type <create_table_tail> opt_create_table_options_etc
2092 opt_create_partitioning_etc opt_duplicate_as_qe
2093
2094 %type <wild_or_where> opt_wild_or_where
2095
2096 // used by JSON_TABLE
2097 %type <jtc_list> columns_clause columns_list
2098 %type <jt_column> jt_column
2099 %type <json_on_response> json_on_response on_empty on_error
2100 %type <json_on_error_or_empty> opt_on_empty_or_error
2101 opt_on_empty_or_error_json_table
2102 %type <jt_column_type> jt_column_type
2103
2104 %type <acl_type> opt_acl_type
2105 %type <histogram> opt_histogram
2106
2107 %type <lex_cstring_list> column_list opt_column_list
2108
2109 %type <role_or_privilege> role_or_privilege
2110
2111 %type <role_or_privilege_list> role_or_privilege_list
2112
2113 %type <with_validation> with_validation opt_with_validation
2114 /*%type <ts_access_mode> ts_access_mode*/
2115
2116 %type <alter_table_action> alter_list_item alter_table_partition_options
2117 %type <ts_options> logfile_group_option_list opt_logfile_group_options
2118 alter_logfile_group_option_list opt_alter_logfile_group_options
2119 tablespace_option_list opt_tablespace_options
2120 alter_tablespace_option_list opt_alter_tablespace_options
2121 opt_drop_ts_options drop_ts_option_list
2122 undo_tablespace_option_list opt_undo_tablespace_options
2123
2124 %type <alter_table_standalone_action> standalone_alter_commands
2125
2126 %type <algo_and_lock_and_validation>alter_commands_modifier
2127 alter_commands_modifier_list
2128
2129 %type <alter_list> alter_list opt_alter_command_list opt_alter_table_actions
2130
2131 %type <standalone_alter_table_action> standalone_alter_table_action
2132
2133 %type <assign_to_keycache> assign_to_keycache
2134
2135 %type <keycache_list> keycache_list
2136
2137 %type <adm_partition> adm_partition
2138
2139 %type <preload_keys> preload_keys
2140
2141 %type <preload_list> preload_list
2142 %type <ts_option>
2143 alter_logfile_group_option
2144 alter_tablespace_option
2145 drop_ts_option
2146 logfile_group_option
2147 tablespace_option
2148 undo_tablespace_option
2149 ts_option_autoextend_size
2150 ts_option_comment
2151 ts_option_engine
2152 ts_option_extent_size
2153 ts_option_file_block_size
2154 ts_option_initial_size
2155 ts_option_max_size
2156 ts_option_nodegroup
2157 ts_option_redo_buffer_size
2158 ts_option_undo_buffer_size
2159 ts_option_wait
2160 ts_option_encryption
2161 ts_option_encryption_key_id
2162 ts_option_engine_attribute
2163
2164 %type <explain_format_type> opt_explain_format_type
2165 %type <explain_format_type> opt_explain_analyze_type
2166
2167 %type <load_set_element> load_data_set_elem
2168
2169 %type <load_set_list> load_data_set_list opt_load_data_set_spec
2170
2171 %type <num> opt_array_cast
2172 %type <sql_cmd_srs_attributes> srs_attributes
2173
2174 %type <insert_update_values_reference> opt_values_reference
2175
2176 %type <alter_tablespace_type> undo_tablespace_state
2177
2178 %type <query_id> opt_for_query
2179
2180 %%
2181
2182 /*
2183 Indentation of grammar rules:
2184
2185 rule: <-- starts at col 1
2186 rule1a rule1b rule1c <-- starts at col 11
2187 { <-- starts at col 11
2188 code <-- starts at col 13, indentation is 2 spaces
2189 }
2190 | rule2a rule2b
2191 {
2192 code
2193 }
2194 ; <-- on a line by itself, starts at col 9
2195
2196 Also, please do not use any <TAB>, but spaces.
2197 Having a uniform indentation in this file helps
2198 code reviews, patches, merges, and make maintenance easier.
2199 Tip: grep [[:cntrl:]] sql_yacc.yy
2200 Thanks.
2201 */
2202
2203 start_entry:
2204 sql_statement
2205 | GRAMMAR_SELECTOR_EXPR bit_expr END_OF_INPUT
2206 {
2207 ITEMIZE($2, &$2);
2208 static_cast<Expression_parser_state *>(YYP)->result= $2;
2209 }
2210 | GRAMMAR_SELECTOR_PART partition_clause END_OF_INPUT
2211 {
2212 /*
2213 We enter here when translating partition info string into
2214 partition_info data structure.
2215 */
2216
7/14
✓ Branch 0 taken 26667 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 26667 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 26667 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 26667 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 26667 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 26667 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 26667 times.
26667 CONTEXTUALIZE($2);
2217 26667 static_cast<Partition_expr_parser_state *>(YYP)->result=
2218 26667 &$2->part_info;
2219 }
2220 | GRAMMAR_SELECTOR_GCOL IDENT_sys '(' expr ')' END_OF_INPUT
2221 {
2222 /*
2223 We enter here when translating generated column info string into
2224 partition_info data structure.
2225 */
2226
2227 // Check gcol expression for the "PARSE_GCOL_EXPR" prefix:
2228
2/4
✓ Branch 0 taken 75127 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 75127 times.
75127 if (!is_identifier($2, "PARSE_GCOL_EXPR"))
2229 MYSQL_YYABORT;
2230
2231
1/2
✓ Branch 0 taken 75127 times.
✗ Branch 1 not taken.
75127 auto gcol_info= NEW_PTN Value_generator;
2232
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 75127 times.
75127 if (gcol_info == NULL)
2233 MYSQL_YYABORT; // OOM
2234
9/14
✓ Branch 0 taken 75127 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 75127 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 75127 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 75127 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 75127 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 75126 times.
✓ Branch 12 taken 1 times.
✓ Branch 13 taken 75126 times.
75127 ITEMIZE($4, &$4);
2235 75126 gcol_info->expr_item= $4;
2236 75126 static_cast<Gcol_expr_parser_state *>(YYP)->result= gcol_info;
2237 }
2238 | GRAMMAR_SELECTOR_CTE table_subquery END_OF_INPUT
2239 {
2240 7161 static_cast<Common_table_expr_parser_state *>(YYP)->result= $2;
2241 }
2242 | GRAMMAR_SELECTOR_DERIVED_EXPR expr END_OF_INPUT
2243 {
2244
7/14
✓ Branch 0 taken 134538 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 134538 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 134538 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 134538 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 134538 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 134538 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 134538 times.
134538 ITEMIZE($2, &$2);
2245 134538 static_cast<Derived_expr_parser_state *>(YYP)->result= $2;
2246 }
2247 ;
2248
2249 sql_statement:
2250 END_OF_INPUT
2251 {
2252 16536 THD *thd= YYTHD;
2253
4/4
✓ Branch 0 taken 14364 times.
✓ Branch 1 taken 2172 times.
✓ Branch 2 taken 21 times.
✓ Branch 3 taken 16515 times.
30900 if (!thd->is_bootstrap_system_thread() &&
2254
2/2
✓ Branch 0 taken 21 times.
✓ Branch 1 taken 14343 times.
14364 !thd->m_parser_state->has_comment())
2255 {
2256
1/2
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
21 my_error(ER_EMPTY_QUERY, MYF(0));
2257 21 MYSQL_YYABORT;
2258 }
2259 16515 thd->lex->sql_command= SQLCOM_EMPTY_QUERY;
2260 16515 YYLIP->found_semicolon= NULL;
2261 }
2262 | simple_statement_or_begin
2263 {
2264 1934717 Lex_input_stream *lip = YYLIP;
2265
2266
1/2
✓ Branch 0 taken 1934717 times.
✗ Branch 1 not taken.
1934717 if (YYTHD->get_protocol()->has_client_capability(CLIENT_MULTI_QUERIES) &&
2267
6/6
✓ Branch 0 taken 81280 times.
✓ Branch 1 taken 1853437 times.
✓ Branch 2 taken 81236 times.
✓ Branch 3 taken 44 times.
✓ Branch 4 taken 81196 times.
✓ Branch 5 taken 1853521 times.
2015953 lip->multi_statements &&
2268
2/2
✓ Branch 0 taken 81196 times.
✓ Branch 1 taken 40 times.
81236 ! lip->eof())
2269 {
2270 /*
2271 We found a well formed query, and multi queries are allowed:
2272 - force the parser to stop after the ';'
2273 - mark the start of the next query for the next invocation
2274 of the parser.
2275 */
2276 81196 lip->next_state= MY_LEX_END;
2277 81196 lip->found_semicolon= lip->get_ptr();
2278 }
2279 else
2280 {
2281 /* Single query, terminated. */
2282 1853521 lip->found_semicolon= NULL;
2283 }
2284 }
2285 ';'
2286 opt_end_of_input
2287 | simple_statement_or_begin END_OF_INPUT
2288 {
2289 /* Single query, not terminated. */
2290 15048185 YYLIP->found_semicolon= NULL;
2291 }
2292 ;
2293
2294 opt_end_of_input:
2295 /* empty */
2296 | END_OF_INPUT
2297 ;
2298
2299 simple_statement_or_begin:
2300 16645592 simple_statement { *parse_tree= $1; }
2301 | begin_stmt
2302 ;
2303
2304 /* Verb clauses, except begin_stmt */
2305 simple_statement:
2306 984 alter_database_stmt { $$= nullptr; }
2307 233 | alter_event_stmt { $$= nullptr; }
2308 176 | alter_function_stmt { $$= nullptr; }
2309 | alter_instance_stmt
2310 5 | alter_logfile_stmt { $$= nullptr; }
2311 215 | alter_procedure_stmt { $$= nullptr; }
2312 | alter_resource_group_stmt
2313 16 | alter_server_stmt { $$= nullptr; }
2314 656 | alter_tablespace_stmt { $$= nullptr; }
2315 544 | alter_undo_tablespace_stmt { $$= nullptr; }
2316 | alter_table_stmt
2317 2684 | alter_user_stmt { $$= nullptr; }
2318 7762 | alter_view_stmt { $$= nullptr; }
2319 | analyze_table_stmt
2320 3705 | binlog_base64_event { $$= nullptr; }
2321 | call_stmt
2322 8007 | change { $$= nullptr; }
2323 | check_table_stmt
2324 25727 | checksum { $$= nullptr; }
2325 327 | clone_stmt { $$= nullptr; }
2326 233752 | commit { $$= nullptr; }
2327 366952 | create { $$= nullptr; }
2328 | create_index_stmt
2329 | create_resource_group_stmt
2330 | create_role_stmt
2331 | create_srs_stmt
2332 | create_table_stmt
2333 40918 | deallocate { $$= nullptr; }
2334 | delete_stmt
2335 | describe_stmt
2336 | do_stmt
2337 6233 | drop_database_stmt { $$= nullptr; }
2338 505 | drop_event_stmt { $$= nullptr; }
2339 18375 | drop_function_stmt { $$= nullptr; }
2340 | drop_index_stmt
2341 5 | drop_logfile_stmt { $$= nullptr; }
2342 19506 | drop_procedure_stmt { $$= nullptr; }
2343 | drop_resource_group_stmt
2344 | drop_role_stmt
2345 149 | drop_server_stmt { $$= nullptr; }
2346 | drop_srs_stmt
2347 934 | drop_tablespace_stmt { $$= nullptr; }
2348 343 | drop_undo_tablespace_stmt { $$= nullptr; }
2349 166919 | drop_table_stmt { $$= nullptr; }
2350 11342 | drop_trigger_stmt { $$= nullptr; }
2351 5631 | drop_user_stmt { $$= nullptr; }
2352 4832 | drop_view_stmt { $$= nullptr; }
2353 93919 | execute { $$= nullptr; }
2354 | explain_stmt
2355 22224 | flush { $$= nullptr; }
2356 804 | get_diagnostics { $$= nullptr; }
2357 4280 | group_replication { $$= nullptr; }
2358 11812 | grant { $$= nullptr; }
2359 | handler_stmt
2360 22 | help { $$= nullptr; }
2361 35 | import_stmt { $$= nullptr; }
2362 | insert_stmt
2363 1233 | install { $$= nullptr; }
2364 2561 | kill { $$= nullptr; }
2365 | load_stmt
2366 3159 | lock { $$= nullptr; }
2367 | optimize_table_stmt
2368 | keycache_stmt
2369 | preload_stmt
2370 46374 | prepare { $$= nullptr; }
2371 137 | purge { $$= nullptr; }
2372 72 | release { $$= nullptr; }
2373 11335 | rename { $$= nullptr; }
2374 | repair_table_stmt
2375 | replace_stmt
2376 26050 | reset { $$= nullptr; }
2377 243 | resignal_stmt { $$= nullptr; }
2378 | restart_server_stmt
2379 4074 | revoke { $$= nullptr; }
2380 13808 | rollback { $$= nullptr; }
2381 6107 | savepoint { $$= nullptr; }
2382 | select_stmt
2383
9/14
✓ Branch 0 taken 1428061 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1428133 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1428136 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1428147 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1428128 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 177 times.
✓ Branch 11 taken 1427951 times.
✓ Branch 12 taken 174 times.
✓ Branch 13 taken 1427940 times.
1428090 | set { $$= nullptr; CONTEXTUALIZE($1); }
2384 | set_resource_group_stmt
2385 | set_role_stmt
2386 | show_binary_logs_stmt
2387 | show_binlog_events_stmt
2388 | show_character_set_stmt
2389 | show_collation_stmt
2390 | show_columns_stmt
2391 | show_count_errors_stmt
2392 | show_count_warnings_stmt
2393 | show_create_database_stmt
2394 | show_create_event_stmt
2395 | show_create_function_stmt
2396 | show_create_procedure_stmt
2397 | show_create_table_stmt
2398 | show_create_trigger_stmt
2399 | show_create_user_stmt
2400 | show_create_view_stmt
2401 | show_databases_stmt
2402 | show_engine_logs_stmt
2403 | show_engine_mutex_stmt
2404 | show_engine_status_stmt
2405 | show_engines_stmt
2406 | show_errors_stmt
2407 | show_events_stmt
2408 | show_function_code_stmt
2409 | show_function_status_stmt
2410 | show_grants_stmt
2411 | show_keys_stmt
2412 | show_master_status_stmt
2413 | show_open_tables_stmt
2414 | show_plugins_stmt
2415 | show_privileges_stmt
2416 | show_procedure_code_stmt
2417 | show_procedure_status_stmt
2418 | show_processlist_stmt
2419 | show_profile_stmt
2420 | show_profiles_stmt
2421 | show_relaylog_events_stmt
2422 | show_replica_status_stmt
2423 | show_replicas_stmt
2424 | show_stats_stmt
2425 | show_status_stmt
2426 | show_table_status_stmt
2427 | show_tables_stmt
2428 | show_triggers_stmt
2429 | show_variables_stmt
2430 | show_warnings_stmt
2431 | shutdown_stmt
2432 12793 | signal_stmt { $$= nullptr; }
2433 4677 | start { $$= nullptr; }
2434 7041 | start_replica_stmt { $$= nullptr; }
2435 5891 | stop_replica_stmt { $$= nullptr; }
2436 | truncate_stmt
2437 1245 | uninstall { $$= nullptr; }
2438 4485 | unlock { $$= nullptr; }
2439 | update_stmt
2440 89898 | use { $$= nullptr; }
2441 3338 | xa { $$= nullptr; }
2442 ;
2443
2444 deallocate:
2445 deallocate_or_drop PREPARE_SYM ident
2446 {
2447 40919 THD *thd= YYTHD;
2448 40919 LEX *lex= thd->lex;
2449 40919 lex->sql_command= SQLCOM_DEALLOCATE_PREPARE;
2450 40919 lex->prepared_stmt_name= to_lex_cstring($3);
2451 }
2452 ;
2453
2454 deallocate_or_drop:
2455 DEALLOCATE_SYM
2456 | DROP
2457 ;
2458
2459 prepare:
2460 PREPARE_SYM ident FROM prepare_src
2461 {
2462 46374 THD *thd= YYTHD;
2463 46374 LEX *lex= thd->lex;
2464 46374 lex->sql_command= SQLCOM_PREPARE;
2465 46374 lex->prepared_stmt_name= to_lex_cstring($2);
2466 /*
2467 We don't know know at this time whether there's a password
2468 in prepare_src, so we err on the side of caution. Setting
2469 the flag will force a rewrite which will obscure all of
2470 prepare_src in the "Query" log line. We'll see the actual
2471 query (with just the passwords obscured, if any) immediately
2472 afterwards in the "Prepare" log lines anyway, and then again
2473 in the "Execute" log line if and when prepare_src is executed.
2474 */
2475 46374 lex->contains_plaintext_password= true;
2476 }
2477 ;
2478
2479 prepare_src:
2480 TEXT_STRING_sys
2481 {
2482 8881 THD *thd= YYTHD;
2483 8881 LEX *lex= thd->lex;
2484 8881 lex->prepared_stmt_code= $1;
2485 8881 lex->prepared_stmt_code_is_varref= false;
2486 }
2487 | '@' ident_or_text
2488 {
2489 37492 THD *thd= YYTHD;
2490 37492 LEX *lex= thd->lex;
2491 37492 lex->prepared_stmt_code= $2;
2492 37492 lex->prepared_stmt_code_is_varref= true;
2493 }
2494 ;
2495
2496 execute:
2497 EXECUTE_SYM ident
2498 {
2499 93919 THD *thd= YYTHD;
2500 93919 LEX *lex= thd->lex;
2501 93919 lex->sql_command= SQLCOM_EXECUTE;
2502 93919 lex->prepared_stmt_name= to_lex_cstring($2);
2503 }
2504 execute_using
2505 {}
2506 ;
2507
2508 execute_using:
2509 /* nothing */
2510 | USING execute_var_list
2511 ;
2512
2513 execute_var_list:
2514 execute_var_list ',' execute_var_ident
2515 | execute_var_ident
2516 ;
2517
2518 execute_var_ident:
2519 '@' ident_or_text
2520 {
2521 16966 LEX *lex=Lex;
2522
1/2
✓ Branch 0 taken 16966 times.
✗ Branch 1 not taken.
16966 LEX_STRING *lexstr= (LEX_STRING*)sql_memdup(&$2, sizeof(LEX_STRING));
2523
4/8
✓ Branch 0 taken 16966 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16966 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 16966 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 16966 times.
16966 if (!lexstr || lex->prepared_stmt_params.push_back(lexstr))
2524 MYSQL_YYABORT;
2525 }
2526 ;
2527
2528 /* help */
2529
2530 help:
2531 HELP_SYM
2532 {
2533
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 22 times.
25 if (Lex->sphead)
2534 {
2535
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_SP_BADSTATEMENT, MYF(0), "HELP");
2536 3 MYSQL_YYABORT;
2537 }
2538 }
2539 ident_or_text
2540 {
2541 22 LEX *lex= Lex;
2542 22 lex->sql_command= SQLCOM_HELP;
2543 22 lex->help_arg= $3.str;
2544 }
2545 ;
2546
2547 /* change master */
2548
2549 change_replication_source:
2550 MASTER_SYM
2551 {
2552
1/2
✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
11 push_deprecated_warn(YYTHD, "CHANGE MASTER",
2553 "CHANGE REPLICATION SOURCE");
2554 }
2555 | REPLICATION SOURCE_SYM
2556 ;
2557
2558 change:
2559 CHANGE change_replication_source TO_SYM
2560 {
2561 7910 LEX *lex = Lex;
2562 7910 lex->sql_command = SQLCOM_CHANGE_MASTER;
2563 /*
2564 Clear LEX_MASTER_INFO struct. repl_ignore_server_ids is cleared
2565 in THD::cleanup_after_query. So it is guaranteed to be empty here.
2566 */
2567
2/4
✓ Branch 0 taken 7910 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7910 times.
7910 assert(Lex->mi.repl_ignore_server_ids.empty());
2568
1/2
✓ Branch 0 taken 7910 times.
✗ Branch 1 not taken.
7910 lex->mi.set_unspecified();
2569 }
2570 source_defs opt_channel
2571 {
2572
2/4
✓ Branch 0 taken 7868 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7868 times.
7868 if (Lex->set_channel_name($6))
2573 MYSQL_YYABORT; // OOM
2574 }
2575 | CHANGE REPLICATION FILTER_SYM
2576 {
2577 144 THD *thd= YYTHD;
2578 144 LEX* lex= thd->lex;
2579
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 144 times.
144 assert(!lex->m_sql_cmd);
2580 144 lex->sql_command = SQLCOM_CHANGE_REPLICATION_FILTER;
2581
1/2
✓ Branch 0 taken 144 times.
✗ Branch 1 not taken.
288 lex->m_sql_cmd= NEW_PTN Sql_cmd_change_repl_filter();
2582
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 144 times.
144 if (lex->m_sql_cmd == NULL)
2583 MYSQL_YYABORT;
2584 }
2585 filter_defs opt_channel
2586 {
2587
2/4
✓ Branch 0 taken 139 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 139 times.
139 if (Lex->set_channel_name($6))
2588 MYSQL_YYABORT; // OOM
2589 }
2590 ;
2591
2592 filter_defs:
2593 filter_def
2594 | filter_defs ',' filter_def
2595 ;
2596 filter_def:
2597 REPLICATE_DO_DB EQ opt_filter_db_list
2598 {
2599 43 Sql_cmd_change_repl_filter * filter_sql_cmd=
2600 43 (Sql_cmd_change_repl_filter*) Lex->m_sql_cmd;
2601
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 43 times.
43 assert(filter_sql_cmd);
2602
1/2
✓ Branch 0 taken 43 times.
✗ Branch 1 not taken.
43 filter_sql_cmd->set_filter_value($3, OPT_REPLICATE_DO_DB);
2603 }
2604 | REPLICATE_IGNORE_DB EQ opt_filter_db_list
2605 {
2606 22 Sql_cmd_change_repl_filter * filter_sql_cmd=
2607 22 (Sql_cmd_change_repl_filter*) Lex->m_sql_cmd;
2608
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
22 assert(filter_sql_cmd);
2609
1/2
✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
22 filter_sql_cmd->set_filter_value($3, OPT_REPLICATE_IGNORE_DB);
2610 }
2611 | REPLICATE_DO_TABLE EQ opt_filter_table_list
2612 {
2613 21 Sql_cmd_change_repl_filter * filter_sql_cmd=
2614 21 (Sql_cmd_change_repl_filter*) Lex->m_sql_cmd;
2615
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
21 assert(filter_sql_cmd);
2616
1/2
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
21 filter_sql_cmd->set_filter_value($3, OPT_REPLICATE_DO_TABLE);
2617 }
2618 | REPLICATE_IGNORE_TABLE EQ opt_filter_table_list
2619 {
2620 26 Sql_cmd_change_repl_filter * filter_sql_cmd=
2621 26 (Sql_cmd_change_repl_filter*) Lex->m_sql_cmd;
2622
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
26 assert(filter_sql_cmd);
2623
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
26 filter_sql_cmd->set_filter_value($3, OPT_REPLICATE_IGNORE_TABLE);
2624 }
2625 | REPLICATE_WILD_DO_TABLE EQ opt_filter_string_list
2626 {
2627 20 Sql_cmd_change_repl_filter * filter_sql_cmd=
2628 20 (Sql_cmd_change_repl_filter*) Lex->m_sql_cmd;
2629
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
20 assert(filter_sql_cmd);
2630
1/2
✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
20 filter_sql_cmd->set_filter_value($3, OPT_REPLICATE_WILD_DO_TABLE);
2631 }
2632 | REPLICATE_WILD_IGNORE_TABLE EQ opt_filter_string_list
2633 {
2634 16 Sql_cmd_change_repl_filter * filter_sql_cmd=
2635 16 (Sql_cmd_change_repl_filter*) Lex->m_sql_cmd;
2636
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 assert(filter_sql_cmd);
2637
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 filter_sql_cmd->set_filter_value($3,
2638 OPT_REPLICATE_WILD_IGNORE_TABLE);
2639 }
2640 | REPLICATE_REWRITE_DB EQ opt_filter_db_pair_list
2641 {
2642 23 Sql_cmd_change_repl_filter * filter_sql_cmd=
2643 23 (Sql_cmd_change_repl_filter*) Lex->m_sql_cmd;
2644
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 23 times.
23 assert(filter_sql_cmd);
2645
1/2
✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
23 filter_sql_cmd->set_filter_value($3, OPT_REPLICATE_REWRITE_DB);
2646 }
2647 ;
2648 opt_filter_db_list:
2649 '(' ')'
2650 {
2651
1/2
✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
19 $$= NEW_PTN mem_root_deque<Item *>(YYMEM_ROOT);
2652
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
19 if ($$ == NULL)
2653 MYSQL_YYABORT;
2654 }
2655 | '(' filter_db_list ')'
2656 {
2657 46 $$= $2;
2658 }
2659 ;
2660
2661 filter_db_list:
2662 filter_db_ident
2663 {
2664
1/2
✓ Branch 0 taken 46 times.
✗ Branch 1 not taken.
46 $$= NEW_PTN mem_root_deque<Item *>(YYMEM_ROOT);
2665
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 46 times.
46 if ($$ == NULL)
2666 MYSQL_YYABORT;
2667
1/2
✓ Branch 0 taken 46 times.
✗ Branch 1 not taken.
46 $$->push_back($1);
2668 }
2669 | filter_db_list ',' filter_db_ident
2670 {
2671
1/2
✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
33 $1->push_back($3);
2672 33 $$= $1;
2673 }
2674 ;
2675
2676 filter_db_ident:
2677 ident /* DB name */
2678 {
2679 111 THD *thd= YYTHD;
2680 111 Item *db_item= NEW_PTN Item_string($1.str, $1.length,
2681
2/4
✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 111 times.
✗ Branch 3 not taken.
111 thd->charset());
2682 111 $$= db_item;
2683 }
2684 ;
2685 opt_filter_db_pair_list:
2686 '(' ')'
2687 {
2688
1/2
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
9 $$= NEW_PTN mem_root_deque<Item *>(YYMEM_ROOT);
2689
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
9 if ($$ == NULL)
2690 MYSQL_YYABORT;
2691 }
2692 |'(' filter_db_pair_list ')'
2693 {
2694 14 $$= $2;
2695 }
2696 ;
2697 filter_db_pair_list:
2698 '(' filter_db_ident ',' filter_db_ident ')'
2699 {
2700
1/2
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
14 $$= NEW_PTN mem_root_deque<Item *>(YYMEM_ROOT);
2701
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if ($$ == NULL)
2702 MYSQL_YYABORT;
2703
1/2
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
14 $$->push_back($2);
2704
1/2
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
14 $$->push_back($4);
2705 }
2706 | filter_db_pair_list ',' '(' filter_db_ident ',' filter_db_ident ')'
2707 {
2708
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $1->push_back($4);
2709
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $1->push_back($6);
2710 2 $$= $1;
2711 }
2712 ;
2713 opt_filter_table_list:
2714 '(' ')'
2715 {
2716
1/2
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
18 $$= NEW_PTN mem_root_deque<Item *>(YYMEM_ROOT);
2717
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
18 if ($$ == NULL)
2718 MYSQL_YYABORT;
2719 }
2720 |'(' filter_table_list ')'
2721 {
2722 29 $$= $2;
2723 }
2724 ;
2725
2726 filter_table_list:
2727 filter_table_ident
2728 {
2729
1/2
✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
29 $$= NEW_PTN mem_root_deque<Item *>(YYMEM_ROOT);
2730
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 29 times.
29 if ($$ == NULL)
2731 MYSQL_YYABORT;
2732
1/2
✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
29 $$->push_back($1);
2733 }
2734 | filter_table_list ',' filter_table_ident
2735 {
2736
1/2
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
14 $1->push_back($3);
2737 14 $$= $1;
2738 }
2739 ;
2740
2741 filter_table_ident:
2742 schema '.' ident /* qualified table name */
2743 {
2744 43 THD *thd= YYTHD;
2745 43 Item_string *table_item= NEW_PTN Item_string($1.str, $1.length,
2746
2/4
✓ Branch 0 taken 43 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 43 times.
✗ Branch 3 not taken.
43 thd->charset());
2747
2/4
✓ Branch 0 taken 43 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 43 times.
✗ Branch 3 not taken.
43 table_item->append(thd->strmake(".", 1), 1);
2748
1/2
✓ Branch 0 taken 43 times.
✗ Branch 1 not taken.
43 table_item->append($3.str, $3.length);
2749 43 $$= table_item;
2750 }
2751 ;
2752
2753 opt_filter_string_list:
2754 '(' ')'
2755 {
2756
1/2
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
13 $$= NEW_PTN mem_root_deque<Item *>(YYMEM_ROOT);
2757
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
13 if ($$ == NULL)
2758 MYSQL_YYABORT;
2759 }
2760 |'(' filter_string_list ')'
2761 {
2762 23 $$= $2;
2763 }
2764 ;
2765
2766 filter_string_list:
2767 filter_string
2768 {
2769
1/2
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
25 $$= NEW_PTN mem_root_deque<Item *>(YYMEM_ROOT);
2770
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
25 if ($$ == NULL)
2771 MYSQL_YYABORT;
2772
1/2
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
25 $$->push_back($1);
2773 }
2774 | filter_string_list ',' filter_string
2775 {
2776
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 $1->push_back($3);
2777 4 $$= $1;
2778 }
2779 ;
2780
2781 filter_string:
2782 filter_wild_db_table_string
2783 {
2784 29 THD *thd= YYTHD;
2785 29 Item *string_item= NEW_PTN Item_string($1.str, $1.length,
2786
2/4
✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29 times.
✗ Branch 3 not taken.
29 thd->charset());
2787 29 $$= string_item;
2788 }
2789 ;
2790
2791 source_defs:
2792 source_def
2793 | source_defs ',' source_def
2794 ;
2795
2796 change_replication_source_auto_position:
2797 MASTER_AUTO_POSITION_SYM
2798 {
2799
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 push_deprecated_warn(YYTHD, "MASTER_AUTO_POSITION",
2800 "SOURCE_AUTO_POSITION");
2801
2802 }
2803 | SOURCE_AUTO_POSITION_SYM
2804 ;
2805
2806 change_replication_source_host:
2807 MASTER_HOST_SYM
2808 {
2809
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 push_deprecated_warn(YYTHD, "MASTER_HOST",
2810 "SOURCE_HOST");
2811 }
2812 | SOURCE_HOST_SYM
2813 ;
2814
2815 change_replication_source_bind:
2816 MASTER_BIND_SYM
2817 {
2818
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_BIND",
2819 "SOURCE_BIND");
2820
2821 }
2822 | SOURCE_BIND_SYM
2823 ;
2824
2825 change_replication_source_user:
2826 MASTER_USER_SYM
2827 {
2828
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 push_deprecated_warn(YYTHD, "MASTER_USER",
2829 "SOURCE_USER");
2830 }
2831 | SOURCE_USER_SYM
2832 ;
2833
2834 change_replication_source_password:
2835 MASTER_PASSWORD_SYM
2836 {
2837
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 push_deprecated_warn(YYTHD, "MASTER_PASSWORD",
2838 "SOURCE_PASSWORD");
2839 }
2840 | SOURCE_PASSWORD_SYM
2841 ;
2842
2843 change_replication_source_port:
2844 MASTER_PORT_SYM
2845 {
2846
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_PORT",
2847 "SOURCE_PORT");
2848 }
2849 | SOURCE_PORT_SYM
2850 ;
2851
2852 change_replication_source_connect_retry:
2853 MASTER_CONNECT_RETRY_SYM
2854 {
2855
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_CONNECT_RETRY",
2856 "SOURCE_CONNECT_RETRY");
2857 }
2858 | SOURCE_CONNECT_RETRY_SYM
2859 ;
2860
2861 change_replication_source_retry_count:
2862 MASTER_RETRY_COUNT_SYM
2863 {
2864
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_RETRY_COUNT",
2865 "SOURCE_RETRY_COUNT");
2866 }
2867 | SOURCE_RETRY_COUNT_SYM
2868 ;
2869
2870 change_replication_source_delay:
2871 MASTER_DELAY_SYM
2872 {
2873
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_DELAY",
2874 "SOURCE_DELAY");
2875 }
2876 | SOURCE_DELAY_SYM
2877 ;
2878
2879 change_replication_source_ssl:
2880 MASTER_SSL_SYM
2881 {
2882
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL",
2883 "SOURCE_SSL");
2884 }
2885 | SOURCE_SSL_SYM
2886 ;
2887
2888 change_replication_source_ssl_ca:
2889 MASTER_SSL_CA_SYM
2890 {
2891
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL_CA",
2892 "SOURCE_SSL_CA");
2893 }
2894 | SOURCE_SSL_CA_SYM
2895 ;
2896
2897 change_replication_source_ssl_capath:
2898 MASTER_SSL_CAPATH_SYM
2899 {
2900
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL_CAPATH",
2901 "SOURCE_SSL_CAPATH");
2902 }
2903 | SOURCE_SSL_CAPATH_SYM
2904 ;
2905
2906 change_replication_source_ssl_cipher:
2907 MASTER_SSL_CIPHER_SYM
2908 {
2909
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL_CIPHER",
2910 "SOURCE_SSL_CIPHER");
2911 }
2912 | SOURCE_SSL_CIPHER_SYM
2913 ;
2914
2915 change_replication_source_ssl_crl:
2916 MASTER_SSL_CRL_SYM
2917 {
2918
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL_CRL",
2919 "SOURCE_SSL_CRL");
2920 }
2921 | SOURCE_SSL_CRL_SYM
2922 ;
2923
2924 change_replication_source_ssl_crlpath:
2925 MASTER_SSL_CRLPATH_SYM
2926 {
2927
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL_CRLPATH",
2928 "SOURCE_SSL_CRLPATH");
2929 }
2930 | SOURCE_SSL_CRLPATH_SYM
2931 ;
2932
2933 change_replication_source_ssl_key:
2934 MASTER_SSL_KEY_SYM
2935 {
2936
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL_KEY",
2937 "SOURCE_SSL_KEY");
2938 }
2939 | SOURCE_SSL_KEY_SYM
2940 ;
2941
2942 change_replication_source_ssl_verify_server_cert:
2943 MASTER_SSL_VERIFY_SERVER_CERT_SYM
2944 {
2945
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL_VERIFY_SERVER_CERT",
2946 "SOURCE_SSL_VERIFY_SERVER_CERT");
2947 }
2948 | SOURCE_SSL_VERIFY_SERVER_CERT_SYM
2949 ;
2950
2951 change_replication_source_tls_version:
2952 MASTER_TLS_VERSION_SYM
2953 {
2954
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_TLS_VERSION",
2955 "SOURCE_TLS_VERSION");
2956 }
2957 | SOURCE_TLS_VERSION_SYM
2958 ;
2959
2960 change_replication_source_tls_ciphersuites:
2961 MASTER_TLS_CIPHERSUITES_SYM
2962 {
2963
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_TLS_CIPHERSUITES",
2964 "SOURCE_TLS_CIPHERSUITES");
2965 }
2966 | SOURCE_TLS_CIPHERSUITES_SYM
2967 ;
2968
2969 change_replication_source_ssl_cert:
2970 MASTER_SSL_CERT_SYM
2971 {
2972
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL_CERT",
2973 "SOURCE_SSL_CERT");
2974 }
2975 | SOURCE_SSL_CERT_SYM
2976 ;
2977
2978 change_replication_source_public_key:
2979 MASTER_PUBLIC_KEY_PATH_SYM
2980 {
2981
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_PUBLIC_KEY_PATH",
2982 "SOURCE_PUBLIC_KEY_PATH");
2983 }
2984 | SOURCE_PUBLIC_KEY_PATH_SYM
2985 ;
2986
2987 change_replication_source_get_source_public_key:
2988 GET_MASTER_PUBLIC_KEY_SYM
2989 {
2990
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "GET_MASTER_PUBLIC_KEY",
2991 "GET_SOURCE_PUBLIC_KEY");
2992 }
2993 | GET_SOURCE_PUBLIC_KEY_SYM
2994 ;
2995
2996 change_replication_source_heartbeat_period:
2997 MASTER_HEARTBEAT_PERIOD_SYM
2998 {
2999
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_HEARTBEAT_PERIOD",
3000 "SOURCE_HEARTBEAT_PERIOD");
3001 }
3002 | SOURCE_HEARTBEAT_PERIOD_SYM
3003 ;
3004
3005 change_replication_source_compression_algorithm:
3006 MASTER_COMPRESSION_ALGORITHM_SYM
3007 {
3008
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_COMPRESSION_ALGORITHM",
3009 "SOURCE_COMPRESSION_ALGORITHM");
3010 }
3011 | SOURCE_COMPRESSION_ALGORITHM_SYM
3012 ;
3013
3014 change_replication_source_zstd_compression_level:
3015 MASTER_ZSTD_COMPRESSION_LEVEL_SYM
3016 {
3017
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_ZSTD_COMPRESSION_LEVEL",
3018 "SOURCE_ZSTD_COMPRESSION_LEVEL");
3019 }
3020 | SOURCE_ZSTD_COMPRESSION_LEVEL_SYM
3021 ;
3022
3023 source_def:
3024 change_replication_source_host EQ TEXT_STRING_sys_nonewline
3025 {
3026 3758 Lex->mi.host = $3.str;
3027 }
3028 | NETWORK_NAMESPACE_SYM EQ TEXT_STRING_sys_nonewline
3029 {
3030 3 Lex->mi.network_namespace = $3.str;
3031 }
3032 | change_replication_source_bind EQ TEXT_STRING_sys_nonewline
3033 {
3034 24 Lex->mi.bind_addr = $3.str;
3035 }
3036 | change_replication_source_user EQ TEXT_STRING_sys_nonewline
3037 {
3038 5510 Lex->mi.user = $3.str;
3039 }
3040 | change_replication_source_password EQ TEXT_STRING_sys_nonewline
3041 {
3042 200 Lex->mi.password = $3.str;
3043
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 199 times.
200 if (strlen($3.str) > 32)
3044 {
3045
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_CHANGE_MASTER_PASSWORD_LENGTH, MYF(0));
3046 1 MYSQL_YYABORT;
3047 }
3048 199 Lex->contains_plaintext_password= true;
3049 }
3050 | change_replication_source_port EQ ulong_num
3051 {
3052 3572 Lex->mi.port = $3;
3053 }
3054 | change_replication_source_connect_retry EQ ulong_num
3055 {
3056 3023 Lex->mi.connect_retry = $3;
3057 }
3058 | change_replication_source_retry_count EQ ulong_num
3059 {
3060 239 Lex->mi.retry_count= $3;
3061 239 Lex->mi.retry_count_opt= LEX_MASTER_INFO::LEX_MI_ENABLE;
3062 }
3063 | change_replication_source_delay EQ ulong_num
3064 {
3065
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 98 times.
99 if ($3 > MASTER_DELAY_MAX)
3066 {
3067
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 const char *msg= YYTHD->strmake(@3.cpp.start, @3.cpp.end - @3.cpp.start);
3068
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_MASTER_DELAY_VALUE_OUT_OF_RANGE, MYF(0),
3069 msg, MASTER_DELAY_MAX);
3070 }
3071 else
3072 98 Lex->mi.sql_delay = $3;
3073 }
3074 | change_replication_source_ssl EQ ulong_num
3075 {
3076
2/2
✓ Branch 0 taken 41 times.
✓ Branch 1 taken 44 times.
85 Lex->mi.ssl= $3 ?
3077 LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE;
3078 }
3079 | change_replication_source_ssl_ca EQ TEXT_STRING_sys_nonewline
3080 {
3081 34 Lex->mi.ssl_ca= $3.str;
3082 }
3083 | change_replication_source_ssl_capath EQ TEXT_STRING_sys_nonewline
3084 {
3085 3 Lex->mi.ssl_capath= $3.str;
3086 }
3087 | change_replication_source_tls_version EQ TEXT_STRING_sys_nonewline
3088 {
3089 9 Lex->mi.tls_version= $3.str;
3090 }
3091 | change_replication_source_tls_ciphersuites EQ source_tls_ciphersuites_def
3092 | change_replication_source_ssl_cert EQ TEXT_STRING_sys_nonewline
3093 {
3094 34 Lex->mi.ssl_cert= $3.str;
3095 }
3096 | change_replication_source_ssl_cipher EQ TEXT_STRING_sys_nonewline
3097 {
3098 3 Lex->mi.ssl_cipher= $3.str;
3099 }
3100 | change_replication_source_ssl_key EQ TEXT_STRING_sys_nonewline
3101 {
3102 34 Lex->mi.ssl_key= $3.str;
3103 }
3104 | change_replication_source_ssl_verify_server_cert EQ ulong_num
3105 {
3106
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 4 times.
14 Lex->mi.ssl_verify_server_cert= $3 ?
3107 LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE;
3108 }
3109 | change_replication_source_ssl_crl EQ TEXT_STRING_sys_nonewline
3110 {
3111 14 Lex->mi.ssl_crl= $3.str;
3112 }
3113 | change_replication_source_ssl_crlpath EQ TEXT_STRING_sys_nonewline
3114 {
3115 14 Lex->mi.ssl_crlpath= $3.str;
3116 }
3117 | change_replication_source_public_key EQ TEXT_STRING_sys_nonewline
3118 {
3119 17 Lex->mi.public_key_path= $3.str;
3120 }
3121 | change_replication_source_get_source_public_key EQ ulong_num
3122 {
3123
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 12 times.
32 Lex->mi.get_public_key= $3 ?
3124 LEX_MASTER_INFO::LEX_MI_ENABLE :
3125 LEX_MASTER_INFO::LEX_MI_DISABLE;
3126 }
3127 | change_replication_source_heartbeat_period EQ NUM_literal
3128 {
3129 91 Item *num= $3;
3130
7/14
✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 91 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 91 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 91 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 91 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 91 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 91 times.
91 ITEMIZE(num, &num);
3131
3132
1/2
✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
91 Lex->mi.heartbeat_period= (float) num->val_real();
3133
2/2
✓ Branch 0 taken 85 times.
✓ Branch 1 taken 6 times.
91 if (Lex->mi.heartbeat_period > SLAVE_MAX_HEARTBEAT_PERIOD ||
3134
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 85 times.
85 Lex->mi.heartbeat_period < 0.0)
3135 {
3136 6 const char format[]= "%d";
3137 char buf[4*sizeof(SLAVE_MAX_HEARTBEAT_PERIOD) + sizeof(format)];
3138 6 sprintf(buf, format, SLAVE_MAX_HEARTBEAT_PERIOD);
3139
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, MYF(0), buf);
3140 6 MYSQL_YYABORT;
3141 }
3142
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 77 times.
85 if (Lex->mi.heartbeat_period > replica_net_timeout)
3143 {
3144
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 push_warning(YYTHD, Sql_condition::SL_WARNING,
3145 ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX,
3146 ER_THD(YYTHD, ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX));
3147 }
3148
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 80 times.
85 if (Lex->mi.heartbeat_period < 0.001)
3149 {
3150
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 if (Lex->mi.heartbeat_period != 0.0)
3151 {
3152
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 push_warning(YYTHD, Sql_condition::SL_WARNING,
3153 ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN,
3154 ER_THD(YYTHD, ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN));
3155 4 Lex->mi.heartbeat_period= 0.0;
3156 }
3157 5 Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_DISABLE;
3158 }
3159 85 Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_ENABLE;
3160 }
3161 | IGNORE_SERVER_IDS_SYM EQ '(' ignore_server_id_list ')'
3162 {
3163 42 Lex->mi.repl_ignore_server_ids_opt= LEX_MASTER_INFO::LEX_MI_ENABLE;
3164 }
3165 | change_replication_source_compression_algorithm EQ TEXT_STRING_sys
3166 {
3167 164 Lex->mi.compression_algorithm = $3.str;
3168 }
3169 | change_replication_source_zstd_compression_level EQ ulong_num
3170 {
3171 142 Lex->mi.zstd_compression_level = $3;
3172 }
3173 | change_replication_source_auto_position EQ ulong_num
3174 {
3175
2/2
✓ Branch 0 taken 1293 times.
✓ Branch 1 taken 2835 times.
4128 Lex->mi.auto_position= $3 ?
3176 LEX_MASTER_INFO::LEX_MI_ENABLE :
3177 LEX_MASTER_INFO::LEX_MI_DISABLE;
3178 }
3179 | PRIVILEGE_CHECKS_USER_SYM EQ privilege_check_def
3180 | REQUIRE_ROW_FORMAT_SYM EQ ulong_num
3181 {
3182
3/3
✓ Branch 0 taken 2812 times.
✓ Branch 1 taken 51 times.
✓ Branch 2 taken 1 times.
2864 switch($3) {
3183 2812 case 0:
3184 2812 Lex->mi.require_row_format =
3185 LEX_MASTER_INFO::LEX_MI_DISABLE;
3186 2812 break;
3187 51 case 1:
3188 51 Lex->mi.require_row_format =
3189 LEX_MASTER_INFO::LEX_MI_ENABLE;
3190 51 break;
3191 1 default:
3192
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 const char* wrong_value = YYTHD->strmake(@3.raw.start, @3.raw.length());
3193
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_REQUIRE_ROW_FORMAT_INVALID_VALUE, MYF(0), wrong_value);
3194 }
3195 }
3196 | REQUIRE_TABLE_PRIMARY_KEY_CHECK_SYM EQ table_primary_key_check_def
3197 | SOURCE_CONNECTION_AUTO_FAILOVER_SYM EQ real_ulong_num
3198 {
3199
2/3
✓ Branch 0 taken 19 times.
✓ Branch 1 taken 94 times.
✗ Branch 2 not taken.
113 switch($3) {
3200 19 case 0:
3201 19 Lex->mi.m_source_connection_auto_failover =
3202 LEX_MASTER_INFO::LEX_MI_DISABLE;
3203 19 break;
3204 94 case 1:
3205 94 Lex->mi.m_source_connection_auto_failover =
3206 LEX_MASTER_INFO::LEX_MI_ENABLE;
3207 94 break;
3208 default:
3209 YYTHD->syntax_error_at(@3);
3210 MYSQL_YYABORT;
3211 }
3212 }
3213 | ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_SYM EQ assign_gtids_to_anonymous_transactions_def
3214 | GTID_ONLY_SYM EQ real_ulong_num
3215 {
3216
3/3
✓ Branch 0 taken 2787 times.
✓ Branch 1 taken 22 times.
✓ Branch 2 taken 1 times.
2810 switch($3) {
3217 2787 case 0:
3218 2787 Lex->mi.m_gtid_only =
3219 LEX_MASTER_INFO::LEX_MI_DISABLE;
3220 2787 break;
3221 22 case 1:
3222 22 Lex->mi.m_gtid_only =
3223 LEX_MASTER_INFO::LEX_MI_ENABLE;
3224 22 break;
3225 1 default:
3226
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error_at(@3,
3227 "You have an error in your CHANGE REPLICATION SOURCE syntax; GTID_ONLY only accepts values 0 or 1");
3228 1 MYSQL_YYABORT;
3229 }
3230 }
3231 | source_file_def
3232 ;
3233
3234 ignore_server_id_list:
3235 /* Empty */
3236 | ignore_server_id
3237 | ignore_server_id_list ',' ignore_server_id
3238 ;
3239
3240 ignore_server_id:
3241 ulong_num
3242 {
3243
1/2
✓ Branch 0 taken 92 times.
✗ Branch 1 not taken.
92 Lex->mi.repl_ignore_server_ids.push_back($1);
3244 }
3245
3246 privilege_check_def:
3247 user_ident_or_text
3248 {
3249 43 Lex->mi.privilege_checks_none= false;
3250 43 Lex->mi.privilege_checks_username= $1->user.str;
3251 43 Lex->mi.privilege_checks_hostname= $1->host.str;
3252 }
3253 | NULL_SYM
3254 {
3255 2797 Lex->mi.privilege_checks_none= true;
3256 2797 Lex->mi.privilege_checks_username= NULL;
3257 2797 Lex->mi.privilege_checks_hostname= NULL;
3258 }
3259 ;
3260
3261 table_primary_key_check_def:
3262 STREAM_SYM
3263 {
3264 5 Lex->mi.require_table_primary_key_check= LEX_MASTER_INFO::LEX_MI_PK_CHECK_STREAM;
3265 }
3266 | ON_SYM
3267 {
3268 8 Lex->mi.require_table_primary_key_check= LEX_MASTER_INFO::LEX_MI_PK_CHECK_ON;
3269 }
3270 | OFF_SYM
3271 {
3272 15 Lex->mi.require_table_primary_key_check= LEX_MASTER_INFO::LEX_MI_PK_CHECK_OFF;
3273 }
3274 ;
3275
3276 assign_gtids_to_anonymous_transactions_def:
3277 OFF_SYM
3278 {
3279 11 Lex->mi.assign_gtids_to_anonymous_transactions_type = LEX_MASTER_INFO::LEX_MI_ANONYMOUS_TO_GTID_OFF;
3280 }
3281 | LOCAL_SYM
3282 {
3283 17 Lex->mi.assign_gtids_to_anonymous_transactions_type = LEX_MASTER_INFO::LEX_MI_ANONYMOUS_TO_GTID_LOCAL;
3284 }
3285 | TEXT_STRING
3286 {
3287 10 Lex->mi.assign_gtids_to_anonymous_transactions_type = LEX_MASTER_INFO::LEX_MI_ANONYMOUS_TO_GTID_UUID;
3288 10 Lex->mi.assign_gtids_to_anonymous_transactions_manual_uuid = $1.str;
3289
3/4
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 9 times.
10 if (!binary_log::Uuid::is_valid($1.str, binary_log::Uuid::TEXT_LENGTH))
3290 {
3291
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_WRONG_VALUE, MYF(0), "UUID", $1.str);
3292 1 MYSQL_YYABORT;
3293 }
3294 }
3295 ;
3296
3297
3298 source_tls_ciphersuites_def:
3299 TEXT_STRING_sys_nonewline
3300 {
3301 13 Lex->mi.tls_ciphersuites = LEX_MASTER_INFO::SPECIFIED_STRING;
3302 13 Lex->mi.tls_ciphersuites_string= $1.str;
3303 }
3304 | NULL_SYM
3305 {
3306 4 Lex->mi.tls_ciphersuites = LEX_MASTER_INFO::SPECIFIED_NULL;
3307 4 Lex->mi.tls_ciphersuites_string = NULL;
3308 }
3309 ;
3310
3311 source_log_file:
3312 MASTER_LOG_FILE_SYM
3313 {
3314
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 push_deprecated_warn(YYTHD, "MASTER_LOG_FILE",
3315 "SOURCE_LOG_FILE");
3316 }
3317 | SOURCE_LOG_FILE_SYM
3318 ;
3319
3320 source_log_pos:
3321 MASTER_LOG_POS_SYM
3322 {
3323
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 push_deprecated_warn(YYTHD, "MASTER_LOG_POS",
3324 "SOURCE_LOG_POS");
3325 }
3326 | SOURCE_LOG_POS_SYM
3327 ;
3328
3329 source_file_def:
3330 source_log_file EQ TEXT_STRING_sys_nonewline
3331 {
3332 141 Lex->mi.log_file_name = $3.str;
3333 }
3334 | source_log_pos EQ ulonglong_num
3335 {
3336 153 Lex->mi.pos = $3;
3337 /*
3338 If the user specified a value < BIN_LOG_HEADER_SIZE, adjust it
3339 instead of causing subsequent errors.
3340 We need to do it in this file, because only there we know that
3341 MASTER_LOG_POS has been explicitely specified. On the contrary
3342 in change_master() (sql_repl.cc) we cannot distinguish between 0
3343 (MASTER_LOG_POS explicitely specified as 0) and 0 (unspecified),
3344 whereas we want to distinguish (specified 0 means "read the binlog
3345 from 0" (4 in fact), unspecified means "don't change the position
3346 (keep the preceding value)").
3347 */
3348 153 Lex->mi.pos = max<ulonglong>(BIN_LOG_HEADER_SIZE, Lex->mi.pos);
3349 }
3350 | RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys_nonewline
3351 {
3352 77 Lex->mi.relay_log_name = $3.str;
3353 }
3354 | RELAY_LOG_POS_SYM EQ ulong_num
3355 {
3356 60 Lex->mi.relay_log_pos = $3;
3357 /* Adjust if < BIN_LOG_HEADER_SIZE (same comment as Lex->mi.pos) */
3358 60 Lex->mi.relay_log_pos = max<ulong>(BIN_LOG_HEADER_SIZE,
3359 60 Lex->mi.relay_log_pos);
3360 }
3361 ;
3362
3363 opt_channel:
3364 /*empty */
3365 170956 { $$ = {}; }
3366 | FOR_SYM CHANNEL_SYM TEXT_STRING_sys_nonewline
3367 22780 { $$ = to_lex_cstring($3); }
3368 ;
3369
3370 create_table_stmt:
3371 CREATE opt_temporary TABLE_SYM opt_if_not_exists table_ident
3372 '(' table_element_list ')' opt_create_table_options_etc
3373 {
3374
1/2
✓ Branch 0 taken 609123 times.
✗ Branch 1 not taken.
1218247 $$= NEW_PTN PT_create_table_stmt(YYMEM_ROOT, $1, $2, $4, $5,
3375 609123 $7,
3376 609123 $9.opt_create_table_options,
3377 $9.opt_partitioning,
3378 $9.on_duplicate,
3379
1/2
✓ Branch 0 taken 609124 times.
✗ Branch 1 not taken.
1218245 $9.opt_query_expression);
3380 }
3381 | CREATE opt_temporary TABLE_SYM opt_if_not_exists table_ident
3382 opt_create_table_options_etc
3383 {
3384
1/2
✓ Branch 0 taken 8696 times.
✗ Branch 1 not taken.
17392 $$= NEW_PTN PT_create_table_stmt(YYMEM_ROOT, $1, $2, $4, $5,
3385 NULL,
3386 8696 $6.opt_create_table_options,
3387 $6.opt_partitioning,
3388 $6.on_duplicate,
3389
1/2
✓ Branch 0 taken 8696 times.
✗ Branch 1 not taken.
17392 $6.opt_query_expression);
3390 }
3391 | CREATE opt_temporary TABLE_SYM opt_if_not_exists table_ident
3392 LIKE table_ident
3393 {
3394
2/4
✓ Branch 0 taken 3558 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3558 times.
✗ Branch 3 not taken.
3558 $$= NEW_PTN PT_create_table_stmt(YYMEM_ROOT, $1, $2, $4, $5, $7);
3395 }
3396 | CREATE opt_temporary TABLE_SYM opt_if_not_exists table_ident
3397 '(' LIKE table_ident ')'
3398 {
3399
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 $$= NEW_PTN PT_create_table_stmt(YYMEM_ROOT, $1, $2, $4, $5, $8);
3400 }
3401 ;
3402
3403 create_role_stmt:
3404 CREATE ROLE_SYM opt_if_not_exists role_list
3405 {
3406
1/2
✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
756 $$= NEW_PTN PT_create_role(!!$3, $4);
3407 }
3408 ;
3409
3410 create_resource_group_stmt:
3411 CREATE RESOURCE_SYM GROUP_SYM ident TYPE_SYM
3412 opt_equal resource_group_types
3413 opt_resource_group_vcpu_list opt_resource_group_priority
3414 opt_resource_group_enable_disable
3415 {
3416
1/2
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
75 $$= NEW_PTN PT_create_resource_group(to_lex_cstring($4), $7, $8, $9,
3417 25 $10.is_default ? true :
3418
1/2
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
50 $10.value);
3419 }
3420 ;
3421
3422 create:
3423 CREATE DATABASE opt_if_not_exists ident
3424 {
3425
1/2
✓ Branch 0 taken 15686 times.
✗ Branch 1 not taken.
15687 Lex->create_info= YYTHD->alloc_typed<HA_CREATE_INFO>();
3426
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 15686 times.
15686 if (Lex->create_info == NULL)
3427 MYSQL_YYABORT; // OOM
3428 15686 Lex->create_info->default_table_charset= NULL;
3429 15686 Lex->create_info->used_fields= 0;
3430 }
3431 opt_create_database_options
3432 {
3433 15677 LEX *lex=Lex;
3434 15677 lex->sql_command=SQLCOM_CREATE_DB;
3435 15677 lex->name= $4;
3436
2/2
✓ Branch 0 taken 731 times.
✓ Branch 1 taken 14946 times.
15677 lex->create_info->options= $3 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
3437 }
3438 | CREATE view_or_trigger_or_sp_or_event
3439 {}
3440 | CREATE USER opt_if_not_exists create_user_list default_role_clause
3441 require_clause connect_options
3442 opt_account_lock_password_expire_options
3443 opt_user_attribute
3444 {
3445 6816 LEX *lex=Lex;
3446 6816 lex->sql_command = SQLCOM_CREATE_USER;
3447 6816 lex->default_roles= $5;
3448
1/2
✓ Branch 0 taken 6816 times.
✗ Branch 1 not taken.
6816 Lex->create_info= YYTHD->alloc_typed<HA_CREATE_INFO>();
3449
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6816 times.
6816 if (Lex->create_info == NULL)
3450 MYSQL_YYABORT; // OOM
3451
2/2
✓ Branch 0 taken 298 times.
✓ Branch 1 taken 6518 times.
6816 lex->create_info->options= $3 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
3452 }
3453 | CREATE LOGFILE_SYM GROUP_SYM ident ADD lg_undofile
3454 opt_logfile_group_options
3455 {
3456
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
6 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
3457
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if (pc == NULL)
3458 MYSQL_YYABORT; /* purecov: inspected */ // OOM
3459
3460
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
6 if ($7 != NULL)
3461 {
3462
5/10
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 4 times.
4 if (YYTHD->is_error() || contextualize_array(pc, $7))
3463 MYSQL_YYABORT; /* purecov: inspected */
3464 }
3465
3466
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
12 Lex->m_sql_cmd= NEW_PTN Sql_cmd_logfile_group{CREATE_LOGFILE_GROUP,
3467
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
12 $4, pc, $6};
3468
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if (!Lex->m_sql_cmd)
3469 MYSQL_YYABORT; /* purecov: inspected */ //OOM
3470
3471 6 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
3472 }
3473 | CREATE TABLESPACE_SYM ident opt_ts_datafile_name
3474 opt_logfile_group_name opt_tablespace_options
3475 {
3476
2/4
✓ Branch 0 taken 1031 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1031 times.
✗ Branch 3 not taken.
1031 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
3477
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1031 times.
1031 if (pc == NULL)
3478 MYSQL_YYABORT; /* purecov: inspected */ // OOM
3479
3480
2/2
✓ Branch 0 taken 754 times.
✓ Branch 1 taken 277 times.
1031 if ($6 != NULL)
3481 {
3482
7/10
✓ Branch 0 taken 754 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 754 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 754 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 753 times.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 753 times.
754 if (YYTHD->is_error() || contextualize_array(pc, $6))
3483 1 MYSQL_YYABORT;
3484 }
3485
3486
2/4
✓ Branch 0 taken 1030 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1030 times.
✗ Branch 3 not taken.
1030 auto cmd= NEW_PTN Sql_cmd_create_tablespace{$3, $4, $5, pc};
3487
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1030 times.
1030 if (!cmd)
3488 MYSQL_YYABORT; /* purecov: inspected */ //OOM
3489 1030 Lex->m_sql_cmd= cmd;
3490 1030 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
3491 }
3492 | CREATE UNDO_SYM TABLESPACE_SYM ident ADD ts_datafile
3493 opt_undo_tablespace_options
3494 {
3495
2/4
✓ Branch 0 taken 368 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 368 times.
✗ Branch 3 not taken.
368 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
3496
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 368 times.
368 if (pc == NULL)
3497 MYSQL_YYABORT; // OOM
3498
3499
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 366 times.
368 if ($7 != NULL)
3500 {
3501
5/10
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
2 if (YYTHD->is_error() || contextualize_array(pc, $7))
3502 MYSQL_YYABORT;
3503 }
3504
3505 auto cmd= NEW_PTN Sql_cmd_create_undo_tablespace{
3506
2/4
✓ Branch 0 taken 368 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 368 times.
✗ Branch 3 not taken.
368 CREATE_UNDO_TABLESPACE, $4, $6, pc};
3507
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 368 times.
368 if (!cmd)
3508 MYSQL_YYABORT; //OOM
3509 368 Lex->m_sql_cmd= cmd;
3510 368 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
3511 }
3512 | CREATE SERVER_SYM ident_or_text FOREIGN DATA_SYM WRAPPER_SYM
3513 ident_or_text OPTIONS_SYM '(' server_options_list ')'
3514 {
3515 35 Lex->sql_command= SQLCOM_CREATE_SERVER;
3516
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 34 times.
35 if ($3.length == 0)
3517 {
3518
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_WRONG_VALUE, MYF(0), "server name", "");
3519 1 MYSQL_YYABORT;
3520 }
3521 34 Lex->server_options.m_server_name= $3;
3522 34 Lex->server_options.set_scheme($7);
3523 34 Lex->m_sql_cmd=
3524
1/2
✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
34 NEW_PTN Sql_cmd_create_server(&Lex->server_options);
3525 }
3526 | CREATE COMPRESSION_DICTIONARY_SYM opt_if_not_exists ident
3527 '(' create_compression_dictionary_allowed_expr ')'
3528 {
3529 81 Lex->sql_command= SQLCOM_CREATE_COMPRESSION_DICTIONARY;
3530
1/2
✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
81 Lex->create_info= YYTHD->alloc_typed<HA_CREATE_INFO>();
3531
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 81 times.
81 if (Lex->create_info == nullptr)
3532 MYSQL_YYABORT; // OOM
3533
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 71 times.
81 Lex->create_info->options= $3 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
3534 81 Lex->ident= $4;
3535 81 Lex->create_info->zip_dict_name = $6;
3536 }
3537 ;
3538
3539 create_srs_stmt:
3540 CREATE OR_SYM REPLACE_SYM SPATIAL_SYM REFERENCE_SYM SYSTEM_SYM
3541 real_ulonglong_num srs_attributes
3542 {
3543
2/4
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48 times.
✗ Branch 3 not taken.
48 $$= NEW_PTN PT_create_srs($7, *$8, true, false);
3544 }
3545 | CREATE SPATIAL_SYM REFERENCE_SYM SYSTEM_SYM opt_if_not_exists
3546 real_ulonglong_num srs_attributes
3547 {
3548
2/4
✓ Branch 0 taken 472 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 472 times.
✗ Branch 3 not taken.
472 $$= NEW_PTN PT_create_srs($6, *$7, false, $5);
3549 }
3550 ;
3551
3552 srs_attributes:
3553 /* empty */
3554 {
3555
1/2
✓ Branch 0 taken 525 times.
✗ Branch 1 not taken.
1050 $$ = NEW_PTN Sql_cmd_srs_attributes();
3556
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 525 times.
525 if (!$$)
3557 MYSQL_YYABORT_ERROR(ER_DA_OOM, MYF(0)); /* purecov: inspected */
3558 }
3559 | srs_attributes NAME_SYM TEXT_STRING_sys_nonewline
3560 {
3561
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 524 times.
525 if ($1->srs_name.str != nullptr)
3562 {
3563
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 MYSQL_YYABORT_ERROR(ER_SRS_MULTIPLE_ATTRIBUTE_DEFINITIONS, MYF(0),
3564 "NAME");
3565 }
3566 else
3567 {
3568 524 $1->srs_name= $3;
3569 }
3570 }
3571 | srs_attributes DEFINITION_SYM TEXT_STRING_sys_nonewline
3572 {
3573
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 521 times.
522 if ($1->definition.str != nullptr)
3574 {
3575
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 MYSQL_YYABORT_ERROR(ER_SRS_MULTIPLE_ATTRIBUTE_DEFINITIONS, MYF(0),
3576 "DEFINITION");
3577 }
3578 else
3579 {
3580 521 $1->definition= $3;
3581 }
3582 }
3583 | srs_attributes ORGANIZATION_SYM TEXT_STRING_sys_nonewline
3584 IDENTIFIED_SYM BY real_ulonglong_num
3585 {
3586
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 30 times.
31 if ($1->organization.str != nullptr)
3587 {
3588
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 MYSQL_YYABORT_ERROR(ER_SRS_MULTIPLE_ATTRIBUTE_DEFINITIONS, MYF(0),
3589 "ORGANIZATION");
3590 }
3591 else
3592 {
3593 30 $1->organization= $3;
3594 30 $1->organization_coordsys_id= $6;
3595 }
3596 }
3597 | srs_attributes DESCRIPTION_SYM TEXT_STRING_sys_nonewline
3598 {
3599
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 4 times.
5 if ($1->description.str != nullptr)
3600 {
3601
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 MYSQL_YYABORT_ERROR(ER_SRS_MULTIPLE_ATTRIBUTE_DEFINITIONS, MYF(0),
3602 "DESCRIPTION");
3603 }
3604 else
3605 {
3606 4 $1->description= $3;
3607 }
3608 }
3609 ;
3610
3611 default_role_clause:
3612 /* empty */
3613 {
3614 6801 $$= 0;
3615 }
3616 |
3617 DEFAULT_SYM ROLE_SYM role_list
3618 {
3619 27 $$= $3;
3620 }
3621 ;
3622
3623 create_index_stmt:
3624 CREATE opt_unique_combo_clustering INDEX_SYM ident opt_index_type_clause
3625 ON_SYM table_ident '(' key_list_with_expression ')' opt_index_options
3626 opt_index_lock_and_algorithm
3627 {
3628
1/2
✓ Branch 0 taken 5999 times.
✗ Branch 1 not taken.
11998 $$= NEW_PTN PT_create_index_stmt(YYMEM_ROOT, $2, $4, $5,
3629 5999 $7, $9, $11,
3630
1/2
✓ Branch 0 taken 5999 times.
✗ Branch 1 not taken.
5999 $12.algo.get_or_default(),
3631
2/4
✓ Branch 0 taken 5999 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5999 times.
✗ Branch 3 not taken.
11998 $12.lock.get_or_default());
3632 }
3633 | CREATE FULLTEXT_SYM INDEX_SYM ident ON_SYM table_ident
3634 '(' key_list_with_expression ')' opt_fulltext_index_options opt_index_lock_and_algorithm
3635 {
3636
1/2
✓ Branch 0 taken 90 times.
✗ Branch 1 not taken.
180 $$= NEW_PTN PT_create_index_stmt(YYMEM_ROOT, KEYTYPE_FULLTEXT, $4,
3637 90 NULL, $6, $8, $10,
3638
1/2
✓ Branch 0 taken 90 times.
✗ Branch 1 not taken.
90 $11.algo.get_or_default(),
3639
2/4
✓ Branch 0 taken 90 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 90 times.
✗ Branch 3 not taken.
180 $11.lock.get_or_default());
3640 }
3641 | CREATE SPATIAL_SYM INDEX_SYM ident ON_SYM table_ident
3642 '(' key_list_with_expression ')' opt_spatial_index_options opt_index_lock_and_algorithm
3643 {
3644
1/2
✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
122 $$= NEW_PTN PT_create_index_stmt(YYMEM_ROOT, KEYTYPE_SPATIAL, $4,
3645 61 NULL, $6, $8, $10,
3646
1/2
✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
61 $11.algo.get_or_default(),
3647
2/4
✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 61 times.
✗ Branch 3 not taken.
122 $11.lock.get_or_default());
3648 }
3649 ;
3650 /*
3651 Only a limited subset of <expr> are allowed in
3652 CREATE COMPRESSION_DICTIONARY.
3653 */
3654 create_compression_dictionary_allowed_expr:
3655 text_literal
3656
7/14
✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 58 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 58 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 58 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 58 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 58 times.
58 { ITEMIZE($1, &$$); }
3657 | rvalue_system_or_user_variable
3658
7/14
✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 23 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 23 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 23 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 23 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 23 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 23 times.
23 { ITEMIZE($1, &$$); }
3659 ;
3660
3661 server_options_list:
3662 server_option
3663 | server_options_list ',' server_option
3664 ;
3665
3666 server_option:
3667 USER TEXT_STRING_sys
3668 {
3669 31 Lex->server_options.set_username($2);
3670 }
3671 | HOST_SYM TEXT_STRING_sys
3672 {
3673 32 Lex->server_options.set_host($2);
3674 }
3675 | DATABASE TEXT_STRING_sys
3676 {
3677 29 Lex->server_options.set_db($2);
3678 }
3679 | OWNER_SYM TEXT_STRING_sys
3680 {
3681 9 Lex->server_options.set_owner($2);
3682 }
3683 | PASSWORD TEXT_STRING_sys
3684 {
3685 13 Lex->server_options.set_password($2);
3686 13 Lex->contains_plaintext_password= true;
3687 }
3688 | SOCKET_SYM TEXT_STRING_sys
3689 {
3690 9 Lex->server_options.set_socket($2);
3691 }
3692 | PORT_SYM ulong_num
3693 {
3694 17 Lex->server_options.set_port($2);
3695 }
3696 ;
3697
3698 event_tail:
3699 EVENT_SYM opt_if_not_exists sp_name
3700 {
3701 950 THD *thd= YYTHD;
3702 950 LEX *lex=Lex;
3703
3704 950 lex->stmt_definition_begin= @1.cpp.start;
3705
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 924 times.
950 lex->create_info->options= $2 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
3706
2/4
✓ Branch 0 taken 950 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 950 times.
1900 if (!(lex->event_parse_data= new (thd->mem_root) Event_parse_data()))
3707 MYSQL_YYABORT;
3708 950 lex->event_parse_data->identifier= $3;
3709 950 lex->event_parse_data->on_completion=
3710 Event_parse_data::ON_COMPLETION_DROP;
3711
3712 950 lex->sql_command= SQLCOM_CREATE_EVENT;
3713 /* We need that for disallowing subqueries */
3714 }
3715 ON_SYM SCHEDULE_SYM ev_schedule_time
3716 opt_ev_on_completion
3717 opt_ev_status
3718 opt_ev_comment
3719 DO_SYM ev_sql_stmt
3720 {
3721 /*
3722 sql_command is set here because some rules in ev_sql_stmt
3723 can overwrite it
3724 */
3725 939 Lex->sql_command= SQLCOM_CREATE_EVENT;
3726 }
3727 ;
3728
3729 ev_schedule_time:
3730 EVERY_SYM expr interval
3731 {
3732
7/14
✓ Branch 0 taken 837 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 837 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 837 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 837 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 837 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 837 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 837 times.
837 ITEMIZE($2, &$2);
3733
3734 837 Lex->event_parse_data->item_expression= $2;
3735 837 Lex->event_parse_data->interval= $3;
3736 }
3737 ev_starts
3738 ev_ends
3739 | AT_SYM expr
3740 {
3741
7/14
✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 196 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 196 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 196 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 196 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 196 times.
196 ITEMIZE($2, &$2);
3742
3743 196 Lex->event_parse_data->item_execute_at= $2;
3744 }
3745 ;
3746
3747 opt_ev_status:
3748 941 /* empty */ { $$= 0; }
3749 | ENABLE_SYM
3750 {
3751 108 Lex->event_parse_data->status= Event_parse_data::ENABLED;
3752 108 Lex->event_parse_data->status_changed= true;
3753 108 $$= 1;
3754 }
3755 | DISABLE_SYM ON_SYM SLAVE
3756 {
3757 9 Lex->event_parse_data->status= Event_parse_data::SLAVESIDE_DISABLED;
3758 9 Lex->event_parse_data->status_changed= true;
3759 9 $$= 1;
3760 }
3761 | DISABLE_SYM
3762 {
3763 127 Lex->event_parse_data->status= Event_parse_data::DISABLED;
3764 127 Lex->event_parse_data->status_changed= true;
3765 127 $$= 1;
3766 }
3767 ;
3768
3769 ev_starts:
3770 /* empty */
3771 {
3772
2/4
✓ Branch 0 taken 683 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 683 times.
✗ Branch 3 not taken.
683 Item *item= NEW_PTN Item_func_now_local(0);
3773
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 683 times.
683 if (item == NULL)
3774 MYSQL_YYABORT;
3775 683 Lex->event_parse_data->item_starts= item;
3776 }
3777 | STARTS_SYM expr
3778 {
3779
7/14
✓ Branch 0 taken 154 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 154 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 154 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 154 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 154 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 154 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 154 times.
154 ITEMIZE($2, &$2);
3780
3781 154 Lex->event_parse_data->item_starts= $2;
3782 }
3783 ;
3784
3785 ev_ends:
3786 /* empty */
3787 | ENDS_SYM expr
3788 {
3789
7/14
✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 72 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 72 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 72 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 72 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 72 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 72 times.
72 ITEMIZE($2, &$2);
3790
3791 72 Lex->event_parse_data->item_ends= $2;
3792 }
3793 ;
3794
3795 opt_ev_on_completion:
3796 784 /* empty */ { $$= 0; }
3797 | ev_on_completion
3798 ;
3799
3800 ev_on_completion:
3801 ON_SYM COMPLETION_SYM PRESERVE_SYM
3802 {
3803 79 Lex->event_parse_data->on_completion=
3804 Event_parse_data::ON_COMPLETION_PRESERVE;
3805 79 $$= 1;
3806 }
3807 | ON_SYM COMPLETION_SYM NOT_SYM PRESERVE_SYM
3808 {
3809 97 Lex->event_parse_data->on_completion=
3810 Event_parse_data::ON_COMPLETION_DROP;
3811 97 $$= 1;
3812 }
3813 ;
3814
3815 opt_ev_comment:
3816 1139 /* empty */ { $$= 0; }
3817 | COMMENT_SYM TEXT_STRING_sys
3818 {
3819 46 Lex->event_parse_data->comment= $2;
3820 46 $$= 1;
3821 }
3822 ;
3823
3824 ev_sql_stmt:
3825 {
3826 971 THD *thd= YYTHD;
3827 971 LEX *lex= thd->lex;
3828
3829 /*
3830 This stops the following :
3831 - CREATE EVENT ... DO CREATE EVENT ...;
3832 - ALTER EVENT ... DO CREATE EVENT ...;
3833 - CREATE EVENT ... DO ALTER EVENT DO ....;
3834 - CREATE PROCEDURE ... BEGIN CREATE EVENT ... END|
3835 This allows:
3836 - CREATE EVENT ... DO DROP EVENT yyy;
3837 - CREATE EVENT ... DO ALTER EVENT yyy;
3838 (the nested ALTER EVENT can have anything but DO clause)
3839 - ALTER EVENT ... DO ALTER EVENT yyy;
3840 (the nested ALTER EVENT can have anything but DO clause)
3841 - ALTER EVENT ... DO DROP EVENT yyy;
3842 - CREATE PROCEDURE ... BEGIN ALTER EVENT ... END|
3843 (the nested ALTER EVENT can have anything but DO clause)
3844 - CREATE PROCEDURE ... BEGIN DROP EVENT ... END|
3845 */
3846
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 966 times.
971 if (lex->sphead)
3847 {
3848
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 my_error(ER_EVENT_RECURSION_FORBIDDEN, MYF(0));
3849 5 MYSQL_YYABORT;
3850 }
3851
3852 1932 sp_head *sp= sp_start_parsing(thd,
3853 enum_sp_type::EVENT,
3854
1/2
✓ Branch 0 taken 966 times.
✗ Branch 1 not taken.
966 lex->event_parse_data->identifier);
3855
3856
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 966 times.
966 if (!sp)
3857 MYSQL_YYABORT;
3858
3859 966 lex->sphead= sp;
3860
3861 966 memset(&lex->sp_chistics, 0, sizeof(st_sp_chistics));
3862 966 sp->m_chistics= &lex->sp_chistics;
3863
3864 /*
3865 Set a body start to the end of the last preprocessed token
3866 before ev_sql_stmt:
3867 */
3868
1/2
✓ Branch 0 taken 966 times.
✗ Branch 1 not taken.
966 sp->set_body_start(thd, @0.cpp.end);
3869 }
3870 ev_sql_stmt_inner
3871 {
3872 965 THD *thd= YYTHD;
3873 965 LEX *lex= thd->lex;
3874
3875
1/2
✓ Branch 0 taken 965 times.
✗ Branch 1 not taken.
965 sp_finish_parsing(thd);
3876
3877 965 lex->sp_chistics.suid= SP_IS_SUID; //always the definer!
3878 965 lex->event_parse_data->body_changed= true;
3879 }
3880 ;
3881
3882 ev_sql_stmt_inner:
3883 sp_proc_stmt_statement
3884 | sp_proc_stmt_return
3885 | sp_proc_stmt_if
3886 | case_stmt_specification
3887 | sp_labeled_block
3888 | sp_unlabeled_block
3889 | sp_labeled_control
3890 | sp_proc_stmt_unlabeled
3891 | sp_proc_stmt_leave
3892 | sp_proc_stmt_iterate
3893 | sp_proc_stmt_open
3894 | sp_proc_stmt_fetch
3895 | sp_proc_stmt_close
3896 ;
3897
3898 sp_name:
3899 ident '.' ident
3900 {
3901
4/4
✓ Branch 0 taken 83903 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 83901 times.
167807 if (!$1.str ||
3902
3/4
✓ Branch 0 taken 83903 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 83900 times.
83903 (check_and_convert_db_name(&$1, false) != Ident_name_check::OK))
3903 3 MYSQL_YYABORT;
3904
3/4
✓ Branch 0 taken 83900 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 83899 times.
83901 if (sp_check_name(&$3))
3905 {
3906 1 MYSQL_YYABORT;
3907 }
3908
1/2
✓ Branch 0 taken 83899 times.
✗ Branch 1 not taken.
83899 $$= new (YYMEM_ROOT) sp_name(to_lex_cstring($1), $3, true);
3909
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 83899 times.
83899 if ($$ == NULL)
3910 MYSQL_YYABORT;
3911
1/2
✓ Branch 0 taken 83900 times.
✗ Branch 1 not taken.
83899 $$->init_qname(YYTHD);
3912 }
3913 | ident
3914 {
3915 406538 THD *thd= YYTHD;
3916 406538 LEX *lex= thd->lex;
3917 LEX_CSTRING db;
3918
3/4
✓ Branch 0 taken 406540 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 30 times.
✓ Branch 3 taken 406510 times.
406538 if (sp_check_name(&$1))
3919 {
3920 41 MYSQL_YYABORT;
3921 }
3922
3/4
✓ Branch 0 taken 406511 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11 times.
✓ Branch 3 taken 406500 times.
406510 if (lex->copy_db_to(&db.str, &db.length))
3923 11 MYSQL_YYABORT;
3924
1/2
✓ Branch 0 taken 406500 times.
✗ Branch 1 not taken.
406500 $$= new (YYMEM_ROOT) sp_name(db, $1, false);
3925
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 406499 times.
406499 if ($$ == NULL)
3926 MYSQL_YYABORT;
3927
1/2
✓ Branch 0 taken 406500 times.
✗ Branch 1 not taken.
406499 $$->init_qname(thd);
3928 }
3929 ;
3930
3931 sp_a_chistics:
3932 /* Empty */ {}
3933 | sp_a_chistics sp_chistic {}
3934 ;
3935
3936 sp_c_chistics:
3937 /* Empty */ {}
3938 | sp_c_chistics sp_c_chistic {}
3939 ;
3940
3941 /* Characteristics for both create and alter */
3942 sp_chistic:
3943 COMMENT_SYM TEXT_STRING_sys
3944 66920 { Lex->sp_chistics.comment= to_lex_cstring($2); }
3945 | LANGUAGE_SYM SQL_SYM
3946 { /* Just parse it, we only have one language for now. */ }
3947 | NO_SYM SQL_SYM
3948 36318 { Lex->sp_chistics.daccess= SP_NO_SQL; }
3949 | CONTAINS_SYM SQL_SYM
3950 1615 { Lex->sp_chistics.daccess= SP_CONTAINS_SQL; }
3951 | READS_SYM SQL_SYM DATA_SYM
3952 20476 { Lex->sp_chistics.daccess= SP_READS_SQL_DATA; }
3953 | MODIFIES_SYM SQL_SYM DATA_SYM
3954 8117 { Lex->sp_chistics.daccess= SP_MODIFIES_SQL_DATA; }
3955 | sp_suid
3956 {}
3957 ;
3958
3959 /* Create characteristics */
3960 sp_c_chistic:
3961 sp_chistic { }
3962 51325 | DETERMINISTIC_SYM { Lex->sp_chistics.detistic= true; }
3963 10798 | not DETERMINISTIC_SYM { Lex->sp_chistics.detistic= false; }
3964 ;
3965
3966 sp_suid:
3967 SQL_SYM SECURITY_SYM DEFINER_SYM
3968 {
3969 186 Lex->sp_chistics.suid= SP_IS_SUID;
3970 }
3971 | SQL_SYM SECURITY_SYM INVOKER_SYM
3972 {
3973 67957 Lex->sp_chistics.suid= SP_IS_NOT_SUID;
3974 }
3975 ;
3976
3977 call_stmt:
3978 CALL_SYM sp_name opt_paren_expr_list
3979 {
3980
1/2
✓ Branch 0 taken 171523 times.
✗ Branch 1 not taken.
171522 $$= NEW_PTN PT_call($1, $2, $3);
3981 }
3982 ;
3983
3984 opt_paren_expr_list:
3985 322 /* Empty */ { $$= NULL; }
3986 | '(' opt_expr_list ')'
3987 {
3988 171199 $$= $2;
3989 }
3990 ;
3991
3992 /* Stored FUNCTION parameter declaration list */
3993 sp_fdparam_list:
3994 /* Empty */
3995 | sp_fdparams
3996 ;
3997
3998 sp_fdparams:
3999 sp_fdparams ',' sp_fdparam
4000 | sp_fdparam
4001 ;
4002
4003 sp_fdparam:
4004 ident type opt_collate
4005 {
4006 87030 THD *thd= YYTHD;
4007 87030 LEX *lex= thd->lex;
4008
4009
7/14
✓ Branch 0 taken 87030 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 87030 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 87030 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 87030 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 87030 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 87030 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 87030 times.
87030 CONTEXTUALIZE($2);
4010 87030 enum_field_types field_type= $2->type;
4011
1/2
✓ Branch 0 taken 87030 times.
✗ Branch 1 not taken.
87030 const CHARSET_INFO *cs= $2->get_charset();
4012
3/4
✓ Branch 0 taken 87030 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 87029 times.
87030 if (merge_sp_var_charset_and_collation(cs, $3, &cs))
4013 1 MYSQL_YYABORT;
4014
4015 87029 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4016
4017
3/4
✓ Branch 0 taken 87029 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 87028 times.
87029 if (sp_check_name(&$1))
4018 1 MYSQL_YYABORT;
4019
4020
3/4
✓ Branch 0 taken 87028 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 87027 times.
87028 if (pctx->find_variable($1.str, $1.length, true))
4021 {
4022
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_DUP_PARAM, MYF(0), $1.str);
4023 1 MYSQL_YYABORT;
4024 }
4025
4026 174054 sp_variable *spvar= pctx->add_variable(thd,
4027
1/2
✓ Branch 0 taken 87027 times.
✗ Branch 1 not taken.
87027 $1,
4028 field_type,
4029 sp_variable::MODE_IN);
4030
4031
3/4
✓ Branch 0 taken 87027 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 87026 times.
261081 if (spvar->field_def.init(thd, "", field_type,
4032
1/2
✓ Branch 0 taken 87027 times.
✗ Branch 1 not taken.
87027 $2->get_length(), $2->get_dec(),
4033
2/4
✓ Branch 0 taken 87027 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 87027 times.
✗ Branch 3 not taken.
87027 $2->get_type_flags(),
4034 NULL, NULL, &NULL_CSTR, 0,
4035
1/2
✓ Branch 0 taken 87027 times.
✗ Branch 1 not taken.
87027 $2->get_interval_list(),
4036 87027 cs ? cs : thd->variables.collation_database,
4037
3/4
✓ Branch 0 taken 87027 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32020 times.
✓ Branch 3 taken 55007 times.
87027 $3 != nullptr, $2->get_uint_geom_type(), nullptr,
4038 nullptr, nullptr, {},
4039 dd::Column::enum_hidden_type::HT_VISIBLE))
4040 {
4041 1 MYSQL_YYABORT;
4042 }
4043
4044
2/4
✓ Branch 0 taken 87026 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 87026 times.
87026 if (prepare_sp_create_field(thd,
4045 &spvar->field_def))
4046 {
4047 MYSQL_YYABORT;
4048 }
4049 87026 spvar->field_def.field_name= spvar->name.str;
4050 87026 spvar->field_def.is_nullable= true;
4051 }
4052 ;
4053
4054 /* Stored PROCEDURE parameter declaration list */
4055 sp_pdparam_list:
4056 /* Empty */
4057 | sp_pdparams
4058 ;
4059
4060 sp_pdparams:
4061 sp_pdparams ',' sp_pdparam
4062 | sp_pdparam
4063 ;
4064
4065 sp_pdparam:
4066 sp_opt_inout ident type opt_collate
4067 {
4068 47203 THD *thd= YYTHD;
4069 47203 LEX *lex= thd->lex;
4070 47203 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4071
4072
3/4
✓ Branch 0 taken 47205 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 47204 times.
47204 if (sp_check_name(&$2))
4073 4 MYSQL_YYABORT;
4074
4075
3/4
✓ Branch 0 taken 47203 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 47202 times.
47204 if (pctx->find_variable($2.str, $2.length, true))
4076 {
4077
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_DUP_PARAM, MYF(0), $2.str);
4078 1 MYSQL_YYABORT;
4079 }
4080
4081
7/14
✓ Branch 0 taken 47202 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 47202 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 47202 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 47203 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 47203 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 47203 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 47202 times.
47202 CONTEXTUALIZE($3);
4082 47202 enum_field_types field_type= $3->type;
4083
1/2
✓ Branch 0 taken 47202 times.
✗ Branch 1 not taken.
47202 const CHARSET_INFO *cs= $3->get_charset();
4084
2/4
✓ Branch 0 taken 47202 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 47202 times.
47202 if (merge_sp_var_charset_and_collation(cs, $4, &cs))
4085 MYSQL_YYABORT;
4086
4087 94402 sp_variable *spvar= pctx->add_variable(thd,
4088 47202 $2,
4089 field_type,
4090
1/2
✓ Branch 0 taken 47200 times.
✗ Branch 1 not taken.
47202 (sp_variable::enum_mode) $1);
4091
4092
3/4
✓ Branch 0 taken 47202 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 47200 times.
141601 if (spvar->field_def.init(thd, "", field_type,
4093
1/2
✓ Branch 0 taken 47201 times.
✗ Branch 1 not taken.
47201 $3->get_length(), $3->get_dec(),
4094
2/4
✓ Branch 0 taken 47201 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 47201 times.
✗ Branch 3 not taken.
47200 $3->get_type_flags(),
4095 NULL, NULL, &NULL_CSTR, 0,
4096
1/2
✓ Branch 0 taken 47200 times.
✗ Branch 1 not taken.
47200 $3->get_interval_list(),
4097 47200 cs ? cs : thd->variables.collation_database,
4098
3/4
✓ Branch 0 taken 47200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 43168 times.
✓ Branch 3 taken 4032 times.
47200 $4 != nullptr, $3->get_uint_geom_type(), nullptr,
4099 nullptr, nullptr, {},
4100 dd::Column::enum_hidden_type::HT_VISIBLE))
4101 {
4102 2 MYSQL_YYABORT;
4103 }
4104
4105
2/4
✓ Branch 0 taken 47201 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 47201 times.
47200 if (prepare_sp_create_field(thd,
4106 &spvar->field_def))
4107 {
4108 MYSQL_YYABORT;
4109 }
4110 47201 spvar->field_def.field_name= spvar->name.str;
4111 47201 spvar->field_def.is_nullable= true;
4112 }
4113 ;
4114
4115 sp_opt_inout:
4116 2538 /* Empty */ { $$= sp_variable::MODE_IN; }
4117 28359 | IN_SYM { $$= sp_variable::MODE_IN; }
4118 15227 | OUT_SYM { $$= sp_variable::MODE_OUT; }
4119 1081 | INOUT_SYM { $$= sp_variable::MODE_INOUT; }
4120 ;
4121
4122 sp_proc_stmts:
4123 /* Empty */ {}
4124 | sp_proc_stmts sp_proc_stmt ';'
4125 ;
4126
4127 sp_proc_stmts1:
4128 sp_proc_stmt ';' {}
4129 | sp_proc_stmts1 sp_proc_stmt ';'
4130 ;
4131
4132 sp_decls:
4133 /* Empty */
4134 {
4135 344802 $$.vars= $$.conds= $$.hndlrs= $$.curs= 0;
4136 }
4137 | sp_decls sp_decl ';'
4138 {
4139 /* We check for declarations out of (standard) order this way
4140 because letting the grammar rules reflect it caused tricky
4141 shift/reduce conflicts with the wrong result. (And we get
4142 better error handling this way.) */
4143
8/8
✓ Branch 0 taken 39295 times.
✓ Branch 1 taken 100352 times.
✓ Branch 2 taken 1473 times.
✓ Branch 3 taken 37822 times.
✓ Branch 4 taken 101821 times.
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 3 times.
✓ Branch 7 taken 101818 times.
139647 if (($2.vars || $2.conds) && ($1.curs || $1.hndlrs))
4144 { /* Variable or condition following cursor or handler */
4145
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
7 my_error(ER_SP_VARCOND_AFTER_CURSHNDLR, MYF(0));
4146 5 MYSQL_YYABORT;
4147 }
4148
4/4
✓ Branch 0 taken 4928 times.
✓ Branch 1 taken 134712 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 4926 times.
139640 if ($2.curs && $1.hndlrs)
4149 { /* Cursor following handler */
4150
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_CURSOR_AFTER_HANDLER, MYF(0));
4151 2 MYSQL_YYABORT;
4152 }
4153 139638 $$.vars= $1.vars + $2.vars;
4154 139638 $$.conds= $1.conds + $2.conds;
4155 139638 $$.hndlrs= $1.hndlrs + $2.hndlrs;
4156 139638 $$.curs= $1.curs + $2.curs;
4157 }
4158 ;
4159
4160 sp_decl:
4161 DECLARE_SYM /*$1*/
4162 sp_decl_idents /*$2*/
4163 type /*$3*/
4164 opt_collate /*$4*/
4165 sp_opt_default /*$5*/
4166 { /*$6*/
4167 100352 THD *thd= YYTHD;
4168 100352 LEX *lex= thd->lex;
4169 100352 sp_head *sp= lex->sphead;
4170 100352 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4171
4172
1/2
✓ Branch 0 taken 100356 times.
✗ Branch 1 not taken.
100354 sp->reset_lex(thd);
4173 100356 lex= thd->lex;
4174
4175 100356 pctx->declare_var_boundary($2);
4176
4177
8/14
✓ Branch 0 taken 100356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100356 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 100356 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 100355 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 100356 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 100356 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 100357 times.
100355 CONTEXTUALIZE($3);
4178 100357 enum enum_field_types var_type= $3->type;
4179
1/2
✓ Branch 0 taken 100356 times.
✗ Branch 1 not taken.
100357 const CHARSET_INFO *cs= $3->get_charset();
4180
3/4
✓ Branch 0 taken 100356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 100355 times.
100356 if (merge_sp_var_charset_and_collation(cs, $4, &cs))
4181 1 MYSQL_YYABORT;
4182
4183
1/2
✓ Branch 0 taken 100355 times.
✗ Branch 1 not taken.
100355 uint num_vars= pctx->context_var_count();
4184 100355 Item *dflt_value_item= $5.expr;
4185
4186 100355 LEX_CSTRING dflt_value_query= EMPTY_CSTR;
4187
4188
2/2
✓ Branch 0 taken 37158 times.
✓ Branch 1 taken 63197 times.
100355 if (dflt_value_item)
4189 {
4190
7/14
✓ Branch 0 taken 37159 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37159 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 37159 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 37159 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 37158 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 37158 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 37158 times.
37158 ITEMIZE(dflt_value_item, &dflt_value_item);
4191 37158 const char *expr_start_ptr= $5.expr_start;
4192
2/2
✓ Branch 0 taken 4606 times.
✓ Branch 1 taken 32552 times.
37158 if (lex->is_metadata_used())
4193 {
4194
1/2
✓ Branch 0 taken 4606 times.
✗ Branch 1 not taken.
4606 dflt_value_query= make_string(thd, expr_start_ptr,
4195 @5.raw.end);
4196
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4606 times.
4606 if (!dflt_value_query.str)
4197 MYSQL_YYABORT;
4198 }
4199 }
4200 else
4201 {
4202
1/2
✓ Branch 0 taken 63196 times.
✗ Branch 1 not taken.
126393 dflt_value_item= NEW_PTN Item_null();
4203
4204
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 63196 times.
63196 if (dflt_value_item == NULL)
4205 MYSQL_YYABORT;
4206 }
4207
4208 // We can have several variables in DECLARE statement.
4209 // We need to create an sp_instr_set instruction for each variable.
4210
4211
2/2
✓ Branch 0 taken 113378 times.
✓ Branch 1 taken 100352 times.
213730 for (uint i = num_vars-$2 ; i < num_vars ; i++)
4212 {
4213 113378 uint var_idx= pctx->var_context2runtime(i);
4214
1/2
✓ Branch 0 taken 113379 times.
✗ Branch 1 not taken.
113378 sp_variable *spvar= pctx->find_variable(var_idx);
4215
4216
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 113379 times.
113379 if (!spvar)
4217 MYSQL_YYABORT;
4218
4219 113379 spvar->type= var_type;
4220 113379 spvar->default_value= dflt_value_item;
4221
4222
3/4
✓ Branch 0 taken 113380 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 113379 times.
340135 if (spvar->field_def.init(thd, "", var_type,
4223
1/2
✓ Branch 0 taken 113378 times.
✗ Branch 1 not taken.
113379 $3->get_length(), $3->get_dec(),
4224
2/4
✓ Branch 0 taken 113379 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 113379 times.
✗ Branch 3 not taken.
113378 $3->get_type_flags(),
4225 NULL, NULL, &NULL_CSTR, 0,
4226
1/2
✓ Branch 0 taken 113378 times.
✗ Branch 1 not taken.
113378 $3->get_interval_list(),
4227 113378 cs ? cs : thd->variables.collation_database,
4228
3/4
✓ Branch 0 taken 113378 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 109460 times.
✓ Branch 3 taken 3918 times.
113379 $4 != nullptr, $3->get_uint_geom_type(), nullptr,
4229 nullptr, nullptr, {},
4230 dd::Column::enum_hidden_type::HT_VISIBLE))
4231 {
4232 1 MYSQL_YYABORT;
4233 }
4234
4235
2/4
✓ Branch 0 taken 113378 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 113378 times.
113379 if (prepare_sp_create_field(thd, &spvar->field_def))
4236 MYSQL_YYABORT;
4237
4238 113378 spvar->field_def.field_name= spvar->name.str;
4239 113378 spvar->field_def.is_nullable= true;
4240
4241 /* The last instruction is responsible for freeing LEX. */
4242
4243
1/2
✓ Branch 0 taken 113379 times.
✗ Branch 1 not taken.
113378 sp_instr_set *is= NEW_PTN sp_instr_set(sp->instructions(),
4244 lex,
4245 var_idx,
4246 dflt_value_item,
4247 dflt_value_query,
4248
2/4
✓ Branch 0 taken 113377 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 113379 times.
✗ Branch 3 not taken.
113379 (i == num_vars - 1));
4249
4250
4/8
✓ Branch 0 taken 113379 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 113376 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 113376 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 113376 times.
113379 if (!is || sp->add_instr(thd, is))
4251 MYSQL_YYABORT;
4252 }
4253
4254 100352 pctx->declare_var_boundary(0);
4255
2/4
✓ Branch 0 taken 100351 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 100351 times.
100351 if (sp->restore_lex(thd))
4256 MYSQL_YYABORT;
4257 100351 $$.vars= $2;
4258 100351 $$.conds= $$.hndlrs= $$.curs= 0;
4259 }
4260 | DECLARE_SYM ident CONDITION_SYM FOR_SYM sp_cond
4261 {
4262 1476 THD *thd= YYTHD;
4263 1476 LEX *lex= thd->lex;
4264 1476 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4265
4266
3/4
✓ Branch 0 taken 1476 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 1473 times.
1476 if (pctx->find_condition($2, true))
4267 {
4268
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_SP_DUP_COND, MYF(0), $2.str);
4269 3 MYSQL_YYABORT;
4270 }
4271
2/4
✓ Branch 0 taken 1473 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1473 times.
1473 if(pctx->add_condition(thd, $2, $5))
4272 MYSQL_YYABORT;
4273 1473 lex->keep_diagnostics= DA_KEEP_DIAGNOSTICS; // DECLARE COND FOR
4274 1473 $$.vars= $$.hndlrs= $$.curs= 0;
4275 1473 $$.conds= 1;
4276 }
4277 | DECLARE_SYM sp_handler_type HANDLER_SYM FOR_SYM
4278 {
4279 32930 THD *thd= YYTHD;
4280 32930 LEX *lex= thd->lex;
4281 32930 sp_head *sp= lex->sphead;
4282
4283 32930 sp_pcontext *parent_pctx= lex->get_sp_current_parsing_ctx();
4284
4285 sp_pcontext *handler_pctx=
4286
1/2
✓ Branch 0 taken 32931 times.
✗ Branch 1 not taken.
32930 parent_pctx->push_context(thd, sp_pcontext::HANDLER_SCOPE);
4287
4288 sp_handler *h=
4289
1/2
✓ Branch 0 taken 32931 times.
✗ Branch 1 not taken.
32931 parent_pctx->add_handler(thd, (sp_handler::enum_type) $2);
4290
4291 32931 lex->set_sp_current_parsing_ctx(handler_pctx);
4292
4293 sp_instr_hpush_jump *i=
4294
3/6
✓ Branch 0 taken 32931 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32931 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 32931 times.
✗ Branch 5 not taken.
32931 NEW_PTN sp_instr_hpush_jump(sp->instructions(), handler_pctx, h);
4295
4296
4/8
✓ Branch 0 taken 32931 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32931 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 32931 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 32931 times.
32931 if (!i || sp->add_instr(thd, i))
4297 MYSQL_YYABORT;
4298
4299
2/2
✓ Branch 0 taken 31491 times.
✓ Branch 1 taken 1440 times.
32931 if ($2 == sp_handler::CONTINUE)
4300 {
4301 // Mark the end of CONTINUE handler scope.
4302
4303
4/8
✓ Branch 0 taken 31491 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 31491 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 31491 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 31491 times.
31491 if (sp->m_parser_data.add_backpatch_entry(
4304 i, handler_pctx->last_label()))
4305 {
4306 MYSQL_YYABORT;
4307 }
4308 }
4309
4310
4/8
✓ Branch 0 taken 32931 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32931 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 32931 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 32931 times.
32931 if (sp->m_parser_data.add_backpatch_entry(
4311 i, handler_pctx->push_label(thd, EMPTY_CSTR, 0)))
4312 {
4313 MYSQL_YYABORT;
4314 }
4315
4316 32931 lex->keep_diagnostics= DA_KEEP_DIAGNOSTICS; // DECL HANDLER FOR
4317 }
4318 sp_hcond_list sp_proc_stmt
4319 {
4320 32894 THD *thd= YYTHD;
4321 32894 LEX *lex= Lex;
4322 32894 sp_head *sp= lex->sphead;
4323 32894 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4324
1/2
✓ Branch 0 taken 32894 times.
✗ Branch 1 not taken.
32894 sp_label *hlab= pctx->pop_label(); /* After this hdlr */
4325
4326
2/2
✓ Branch 0 taken 31460 times.
✓ Branch 1 taken 1434 times.
32894 if ($2 == sp_handler::CONTINUE)
4327 {
4328 sp_instr_hreturn *i=
4329
3/6
✓ Branch 0 taken 31460 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 31460 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 31460 times.
✗ Branch 5 not taken.
31460 NEW_PTN sp_instr_hreturn(sp->instructions(), pctx);
4330
4331
4/8
✓ Branch 0 taken 31460 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 31460 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 31460 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 31460 times.
31460 if (!i || sp->add_instr(thd, i))
4332 MYSQL_YYABORT;
4333 }
4334 else
4335 { /* EXIT or UNDO handler, just jump to the end of the block */
4336 sp_instr_hreturn *i=
4337
3/6
✓ Branch 0 taken 1434 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1434 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1434 times.
✗ Branch 5 not taken.
1434 NEW_PTN sp_instr_hreturn(sp->instructions(), pctx);
4338
4339 2868 if (i == NULL ||
4340
4/8
✓ Branch 0 taken 1434 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1434 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1434 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1434 times.
2868 sp->add_instr(thd, i) ||
4341
4/8
✓ Branch 0 taken 1434 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1434 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1434 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1434 times.
1434 sp->m_parser_data.add_backpatch_entry(i, pctx->last_label()))
4342 MYSQL_YYABORT;
4343 }
4344
4345
2/4
✓ Branch 0 taken 32894 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32894 times.
✗ Branch 3 not taken.
32894 sp->m_parser_data.do_backpatch(hlab, sp->instructions());
4346
4347
1/2
✓ Branch 0 taken 32894 times.
✗ Branch 1 not taken.
32894 lex->set_sp_current_parsing_ctx(pctx->pop_context());
4348
4349 32894 $$.vars= $$.conds= $$.curs= 0;
4350 32894 $$.hndlrs= 1;
4351 }
4352 | DECLARE_SYM /*$1*/
4353 ident /*$2*/
4354 CURSOR_SYM /*$3*/
4355 FOR_SYM /*$4*/
4356 { /*$5*/
4357 4934 THD *thd= YYTHD;
4358 4934 LEX *lex= Lex;
4359 4934 sp_head *sp= lex->sphead;
4360
4361
1/2
✓ Branch 0 taken 4934 times.
✗ Branch 1 not taken.
4934 sp->reset_lex(thd);
4362 4934 sp->m_parser_data.set_current_stmt_start_ptr(@4.raw.end);
4363 }
4364 select_stmt /*$6*/
4365 { /*$7*/
4366
5/10
✓ Branch 0 taken 4932 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4932 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4932 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 4932 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 4932 times.
4936 MAKE_CMD($6);
4367
4368 4932 THD *thd= YYTHD;
4369 4932 LEX *cursor_lex= Lex;
4370 4932 sp_head *sp= cursor_lex->sphead;
4371
4372
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4932 times.
4932 assert(cursor_lex->sql_command == SQLCOM_SELECT);
4373
4374
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 4930 times.
4932 if (cursor_lex->result)
4375 {
4376
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_BAD_CURSOR_SELECT, MYF(0));
4377 2 MYSQL_YYABORT;
4378 }
4379
4380 4930 cursor_lex->m_sql_cmd->set_as_part_of_sp();
4381 4930 cursor_lex->sp_lex_in_use= true;
4382
4383
2/4
✓ Branch 0 taken 4930 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4930 times.
4930 if (sp->restore_lex(thd))
4384 MYSQL_YYABORT;
4385
4386 4930 LEX *lex= Lex;
4387 4930 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4388
4389 uint offp;
4390
4391
3/4
✓ Branch 0 taken 4930 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 4928 times.
4930 if (pctx->find_cursor($2, &offp, true))
4392 {
4393
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_DUP_CURS, MYF(0), $2.str);
4394
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 delete cursor_lex;
4395 2 MYSQL_YYABORT;
4396 }
4397
4398 4928 LEX_CSTRING cursor_query= EMPTY_CSTR;
4399
4400
2/2
✓ Branch 0 taken 4916 times.
✓ Branch 1 taken 12 times.
4928 if (cursor_lex->is_metadata_used())
4401 {
4402 cursor_query=
4403
1/2
✓ Branch 0 taken 4916 times.
✗ Branch 1 not taken.
4916 make_string(thd,
4404 sp->m_parser_data.get_current_stmt_start_ptr(),
4405 @6.raw.end);
4406
4407
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4916 times.
4916 if (!cursor_query.str)
4408 MYSQL_YYABORT;
4409 }
4410
4411 sp_instr_cpush *i=
4412
1/2
✓ Branch 0 taken 4928 times.
✗ Branch 1 not taken.
4928 NEW_PTN sp_instr_cpush(sp->instructions(), pctx,
4413 cursor_lex, cursor_query,
4414
3/6
✓ Branch 0 taken 4928 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4928 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4928 times.
✗ Branch 5 not taken.
4928 pctx->current_cursor_count());
4415
4416 9856 if (i == NULL ||
4417
4/8
✓ Branch 0 taken 4928 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4928 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4928 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 4928 times.
9856 sp->add_instr(thd, i) ||
4418
2/4
✓ Branch 0 taken 4928 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4928 times.
4928 pctx->add_cursor($2))
4419 {
4420 MYSQL_YYABORT;
4421 }
4422
4423 4928 $$.vars= $$.conds= $$.hndlrs= 0;
4424 4928 $$.curs= 1;
4425 }
4426 ;
4427
4428 sp_handler_type:
4429 1442 EXIT_SYM { $$= sp_handler::EXIT; }
4430 31493 | CONTINUE_SYM { $$= sp_handler::CONTINUE; }
4431 /*| UNDO_SYM { QQ No yet } */
4432 ;
4433
4434 sp_hcond_list:
4435 sp_hcond_element
4436 32898 { $$= 1; }
4437 | sp_hcond_list ',' sp_hcond_element
4438 1052 { $$+= 1; }
4439 ;
4440
4441 sp_hcond_element:
4442 sp_hcond
4443 {
4444 33957 LEX *lex= Lex;
4445 33957 sp_head *sp= lex->sphead;
4446 33957 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4447 33957 sp_pcontext *parent_pctx= pctx->parent_context();
4448
4449
3/4
✓ Branch 0 taken 33957 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 33950 times.
33957 if (parent_pctx->check_duplicate_handler($1))
4450 {
4451
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 my_error(ER_SP_DUP_HANDLER, MYF(0));
4452 7 MYSQL_YYABORT;
4453 }
4454 else
4455 {
4456 sp_instr_hpush_jump *i=
4457
1/2
✓ Branch 0 taken 33950 times.
✗ Branch 1 not taken.
33950 (sp_instr_hpush_jump *)sp->last_instruction();
4458
4459
1/2
✓ Branch 0 taken 33950 times.
✗ Branch 1 not taken.
33950 i->add_condition($1);
4460 }
4461 }
4462 ;
4463
4464 sp_cond:
4465 ulong_num
4466 { /* mysql errno */
4467
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2425 times.
2427 if ($1 == 0)
4468 {
4469
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_WRONG_VALUE, MYF(0), "CONDITION", "0");
4470 2 MYSQL_YYABORT;
4471 }
4472
1/2
✓ Branch 0 taken 2425 times.
✗ Branch 1 not taken.
2425 $$= NEW_PTN sp_condition_value($1);
4473
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2425 times.
2425 if ($$ == NULL)
4474 MYSQL_YYABORT;
4475 }
4476 | sqlstate
4477 ;
4478
4479 sqlstate:
4480 SQLSTATE_SYM opt_value TEXT_STRING_literal
4481 { /* SQLSTATE */
4482
4483 /*
4484 An error is triggered:
4485 - if the specified string is not a valid SQLSTATE,
4486 - or if it represents the completion condition -- it is not
4487 allowed to SIGNAL, or declare a handler for the completion
4488 condition.
4489 */
4490
7/8
✓ Branch 0 taken 14923 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14896 times.
✓ Branch 3 taken 27 times.
✓ Branch 4 taken 17 times.
✓ Branch 5 taken 14879 times.
✓ Branch 6 taken 44 times.
✓ Branch 7 taken 14879 times.
14923 if (!is_sqlstate_valid(&$3) || is_sqlstate_completion($3.str))
4491 {
4492
1/2
✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
44 my_error(ER_SP_BAD_SQLSTATE, MYF(0), $3.str);
4493 44 MYSQL_YYABORT;
4494 }
4495
1/2
✓ Branch 0 taken 14879 times.
✗ Branch 1 not taken.
14879 $$= NEW_PTN sp_condition_value($3.str);
4496
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14879 times.
14879 if ($$ == NULL)
4497 MYSQL_YYABORT;
4498 }
4499 ;
4500
4501 opt_value:
4502 /* Empty */ {}
4503 | VALUE_SYM {}
4504 ;
4505
4506 sp_hcond:
4507 sp_cond
4508 {
4509 3148 $$= $1;
4510 }
4511 | ident /* CONDITION name */
4512 {
4513 171 LEX *lex= Lex;
4514 171 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4515
4516
1/2
✓ Branch 0 taken 171 times.
✗ Branch 1 not taken.
171 $$= pctx->find_condition($1, false);
4517
4518
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 163 times.
171 if ($$ == NULL)
4519 {
4520
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str);
4521 8 MYSQL_YYABORT;
4522 }
4523 }
4524 | SQLWARNING_SYM /* SQLSTATEs 01??? */
4525 {
4526
1/2
✓ Branch 0 taken 703 times.
✗ Branch 1 not taken.
703 $$= NEW_PTN sp_condition_value(sp_condition_value::WARNING);
4527
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 703 times.
703 if ($$ == NULL)
4528 MYSQL_YYABORT;
4529 }
4530 | not FOUND_SYM /* SQLSTATEs 02??? */
4531 {
4532
1/2
✓ Branch 0 taken 3338 times.
✗ Branch 1 not taken.
3338 $$= NEW_PTN sp_condition_value(sp_condition_value::NOT_FOUND);
4533
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3338 times.
3338 if ($$ == NULL)
4534 MYSQL_YYABORT;
4535 }
4536 | SQLEXCEPTION_SYM /* All other SQLSTATEs */
4537 {
4538
1/2
✓ Branch 0 taken 26605 times.
✗ Branch 1 not taken.
26605 $$= NEW_PTN sp_condition_value(sp_condition_value::EXCEPTION);
4539
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26605 times.
26605 if ($$ == NULL)
4540 MYSQL_YYABORT;
4541 }
4542 ;
4543
4544 signal_stmt:
4545 SIGNAL_SYM signal_value opt_set_signal_information
4546 {
4547 12793 THD *thd= YYTHD;
4548 12793 LEX *lex= thd->lex;
4549
4550 12793 lex->sql_command= SQLCOM_SIGNAL;
4551
1/2
✓ Branch 0 taken 12793 times.
✗ Branch 1 not taken.
12793 lex->m_sql_cmd= NEW_PTN Sql_cmd_signal($2, $3);
4552
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 12793 times.
12793 if (lex->m_sql_cmd == NULL)
4553 MYSQL_YYABORT;
4554 }
4555 ;
4556
4557 signal_value:
4558 ident
4559 {
4560 297 LEX *lex= Lex;
4561 297 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4562
4563
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 295 times.
297 if (!pctx)
4564 {
4565 /* SIGNAL foo cannot be used outside of stored programs */
4566
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str);
4567 2 MYSQL_YYABORT;
4568 }
4569
4570
1/2
✓ Branch 0 taken 295 times.
✗ Branch 1 not taken.
295 sp_condition_value *cond= pctx->find_condition($1, false);
4571
4572
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 293 times.
295 if (!cond)
4573 {
4574
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str);
4575 2 MYSQL_YYABORT;
4576 }
4577
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 291 times.
293 if (cond->type != sp_condition_value::SQLSTATE)
4578 {
4579
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SIGNAL_BAD_CONDITION_TYPE, MYF(0));
4580 2 MYSQL_YYABORT;
4581 }
4582 291 $$= cond;
4583 }
4584 | sqlstate
4585 12680 { $$= $1; }
4586 ;
4587
4588 opt_signal_value:
4589 /* empty */
4590 90 { $$= NULL; }
4591 | signal_value
4592 156 { $$= $1; }
4593 ;
4594
4595 opt_set_signal_information:
4596 /* empty */
4597
1/2
✓ Branch 0 taken 238 times.
✗ Branch 1 not taken.
476 { $$= NEW_PTN Set_signal_information(); }
4598 | SET_SYM signal_information_item_list
4599 12798 { $$= $2; }
4600 ;
4601
4602 signal_information_item_list:
4603 signal_condition_information_item_name EQ signal_allowed_expr
4604 {
4605
1/2
✓ Branch 0 taken 12804 times.
✗ Branch 1 not taken.
25608 $$= NEW_PTN Set_signal_information();
4606
2/4
✓ Branch 0 taken 12804 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 12804 times.
12804 if ($$->set_item($1, $3))
4607 MYSQL_YYABORT;
4608 }
4609 | signal_information_item_list ','
4610 signal_condition_information_item_name EQ signal_allowed_expr
4611 {
4612 1807 $$= $1;
4613
3/4
✓ Branch 0 taken 1807 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 1801 times.
1807 if ($$->set_item($3, $5))
4614 6 MYSQL_YYABORT;
4615 }
4616 ;
4617
4618 /*
4619 Only a limited subset of <expr> are allowed in SIGNAL/RESIGNAL.
4620 */
4621 signal_allowed_expr:
4622 literal_or_null
4623
7/14
✓ Branch 0 taken 9862 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9862 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9862 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 9862 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 9862 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 9862 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 9862 times.
9862 { ITEMIZE($1, &$$); }
4624 | rvalue_system_or_user_variable
4625
7/14
✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 50 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 50 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 50 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 50 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 50 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 50 times.
50 { ITEMIZE($1, &$$); }
4626 | simple_ident
4627
7/14
✓ Branch 0 taken 5421 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5421 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5421 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5421 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 5421 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 5421 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 5421 times.
5421 { ITEMIZE($1, &$$); }
4628 ;
4629
4630 /* conditions that can be set in signal / resignal */
4631 signal_condition_information_item_name:
4632 CLASS_ORIGIN_SYM
4633 17 { $$= CIN_CLASS_ORIGIN; }
4634 | SUBCLASS_ORIGIN_SYM
4635 13 { $$= CIN_SUBCLASS_ORIGIN; }
4636 | CONSTRAINT_CATALOG_SYM
4637 13 { $$= CIN_CONSTRAINT_CATALOG; }
4638 | CONSTRAINT_SCHEMA_SYM
4639 13 { $$= CIN_CONSTRAINT_SCHEMA; }
4640 | CONSTRAINT_NAME_SYM
4641 13 { $$= CIN_CONSTRAINT_NAME; }
4642 | CATALOG_NAME_SYM
4643 13 { $$= CIN_CATALOG_NAME; }
4644 | SCHEMA_NAME_SYM
4645 17 { $$= CIN_SCHEMA_NAME; }
4646 | TABLE_NAME_SYM
4647 17 { $$= CIN_TABLE_NAME; }
4648 | COLUMN_NAME_SYM
4649 13 { $$= CIN_COLUMN_NAME; }
4650 | CURSOR_NAME_SYM
4651 13 { $$= CIN_CURSOR_NAME; }
4652 | MESSAGE_TEXT_SYM
4653 12674 { $$= CIN_MESSAGE_TEXT; }
4654 | MYSQL_ERRNO_SYM
4655 1796 { $$= CIN_MYSQL_ERRNO; }
4656 ;
4657
4658 resignal_stmt:
4659 RESIGNAL_SYM opt_signal_value opt_set_signal_information
4660 {
4661 243 THD *thd= YYTHD;
4662 243 LEX *lex= thd->lex;
4663
4664 243 lex->sql_command= SQLCOM_RESIGNAL;
4665 243 lex->keep_diagnostics= DA_KEEP_DIAGNOSTICS; // RESIGNAL doesn't clear diagnostics
4666
1/2
✓ Branch 0 taken 243 times.
✗ Branch 1 not taken.
243 lex->m_sql_cmd= NEW_PTN Sql_cmd_resignal($2, $3);
4667
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 243 times.
243 if (lex->m_sql_cmd == NULL)
4668 MYSQL_YYABORT;
4669 }
4670 ;
4671
4672 get_diagnostics:
4673 GET_SYM which_area DIAGNOSTICS_SYM diagnostics_information
4674 {
4675 804 Diagnostics_information *info= $4;
4676
4677 804 info->set_which_da($2);
4678
4679 804 Lex->keep_diagnostics= DA_KEEP_DIAGNOSTICS; // GET DIAGS doesn't clear them.
4680 804 Lex->sql_command= SQLCOM_GET_DIAGNOSTICS;
4681
1/2
✓ Branch 0 taken 804 times.
✗ Branch 1 not taken.
804 Lex->m_sql_cmd= NEW_PTN Sql_cmd_get_diagnostics(info);
4682
4683
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 804 times.
804 if (Lex->m_sql_cmd == NULL)
4684 MYSQL_YYABORT;
4685 }
4686 ;
4687
4688 which_area:
4689 /* If <which area> is not specified, then CURRENT is implicit. */
4690 819 { $$= Diagnostics_information::CURRENT_AREA; }
4691 | CURRENT_SYM
4692 18 { $$= Diagnostics_information::CURRENT_AREA; }
4693 | STACKED_SYM
4694 15 { $$= Diagnostics_information::STACKED_AREA; }
4695 ;
4696
4697 diagnostics_information:
4698 statement_information
4699 {
4700
1/2
✓ Branch 0 taken 102 times.
✗ Branch 1 not taken.
102 $$= NEW_PTN Statement_information($1);
4701
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 102 times.
102 if ($$ == NULL)
4702 MYSQL_YYABORT;
4703 }
4704 | CONDITION_SYM condition_number condition_information
4705 {
4706
1/2
✓ Branch 0 taken 702 times.
✗ Branch 1 not taken.
702 $$= NEW_PTN Condition_information($2, $3);
4707
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 702 times.
702 if ($$ == NULL)
4708 MYSQL_YYABORT;
4709 }
4710 ;
4711
4712 statement_information:
4713 statement_information_item
4714 {
4715
1/2
✓ Branch 0 taken 106 times.
✗ Branch 1 not taken.
106 $$= NEW_PTN List<Statement_information_item>;
4716
4/8
✓ Branch 0 taken 106 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 106 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 106 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 106 times.
106 if ($$ == NULL || $$->push_back($1))
4717 MYSQL_YYABORT;
4718 }
4719 | statement_information ',' statement_information_item
4720 {
4721
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
8 if ($1->push_back($3))
4722 MYSQL_YYABORT;
4723 8 $$= $1;
4724 }
4725 ;
4726
4727 statement_information_item:
4728 simple_target_specification EQ statement_information_item_name
4729 {
4730
1/2
✓ Branch 0 taken 114 times.
✗ Branch 1 not taken.
114 $$= NEW_PTN Statement_information_item($3, $1);
4731
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 114 times.
114 if ($$ == NULL)
4732 MYSQL_YYABORT;
4733 }
4734
4735 simple_target_specification:
4736 ident
4737 {
4738 1138 THD *thd= YYTHD;
4739 1138 LEX *lex= thd->lex;
4740 1138 sp_head *sp= lex->sphead;
4741
4742 /*
4743 NOTE: lex->sphead is NULL if we're parsing something like
4744 'GET DIAGNOSTICS v' outside a stored program. We should throw
4745 ER_SP_UNDECLARED_VAR in such cases.
4746 */
4747
4748
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1136 times.
1138 if (!sp)
4749 {
4750
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
4751 2 MYSQL_YYABORT;
4752 }
4753
4754 1136 $$=
4755
1/2
✓ Branch 0 taken 1136 times.
✗ Branch 1 not taken.
2272 create_item_for_sp_var(
4756 1136 thd, to_lex_cstring($1), NULL,
4757 sp->m_parser_data.get_current_stmt_start_ptr(),
4758 @1.raw.start,
4759 @1.raw.end);
4760
4761
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1130 times.
1136 if ($$ == NULL)
4762 6 MYSQL_YYABORT;
4763 }
4764 | '@' ident_or_text
4765 {
4766
2/4
✓ Branch 0 taken 383 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 383 times.
✗ Branch 3 not taken.
383 $$= NEW_PTN Item_func_get_user_var(@$, $2);
4767
7/14
✓ Branch 0 taken 383 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 383 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 383 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 383 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 383 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 383 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 383 times.
383 ITEMIZE($$, &$$);
4768 }
4769 ;
4770
4771 statement_information_item_name:
4772 NUMBER_SYM
4773 91 { $$= Statement_information_item::NUMBER; }
4774 | ROW_COUNT_SYM
4775 23 { $$= Statement_information_item::ROW_COUNT; }
4776 ;
4777
4778 /*
4779 Only a limited subset of <expr> are allowed in GET DIAGNOSTICS
4780 <condition number>, same subset as for SIGNAL/RESIGNAL.
4781 */
4782 condition_number:
4783 signal_allowed_expr
4784 722 { $$= $1; }
4785 ;
4786
4787 condition_information:
4788 condition_information_item
4789 {
4790
1/2
✓ Branch 0 taken 706 times.
✗ Branch 1 not taken.
706 $$= NEW_PTN List<Condition_information_item>;
4791
4/8
✓ Branch 0 taken 706 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 706 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 706 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 706 times.
706 if ($$ == NULL || $$->push_back($1))
4792 MYSQL_YYABORT;
4793 }
4794 | condition_information ',' condition_information_item
4795 {
4796
2/4
✓ Branch 0 taken 674 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 674 times.
674 if ($1->push_back($3))
4797 MYSQL_YYABORT;
4798 674 $$= $1;
4799 }
4800 ;
4801
4802 condition_information_item:
4803 simple_target_specification EQ condition_information_item_name
4804 {
4805
1/2
✓ Branch 0 taken 1380 times.
✗ Branch 1 not taken.
1380 $$= NEW_PTN Condition_information_item($3, $1);
4806
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1380 times.
1380 if ($$ == NULL)
4807 MYSQL_YYABORT;
4808 }
4809
4810 condition_information_item_name:
4811 CLASS_ORIGIN_SYM
4812 30 { $$= Condition_information_item::CLASS_ORIGIN; }
4813 | SUBCLASS_ORIGIN_SYM
4814 12 { $$= Condition_information_item::SUBCLASS_ORIGIN; }
4815 | CONSTRAINT_CATALOG_SYM
4816 4 { $$= Condition_information_item::CONSTRAINT_CATALOG; }
4817 | CONSTRAINT_SCHEMA_SYM
4818 4 { $$= Condition_information_item::CONSTRAINT_SCHEMA; }
4819 | CONSTRAINT_NAME_SYM
4820 4 { $$= Condition_information_item::CONSTRAINT_NAME; }
4821 | CATALOG_NAME_SYM
4822 4 { $$= Condition_information_item::CATALOG_NAME; }
4823 | SCHEMA_NAME_SYM
4824 4 { $$= Condition_information_item::SCHEMA_NAME; }
4825 | TABLE_NAME_SYM
4826 6 { $$= Condition_information_item::TABLE_NAME; }
4827 | COLUMN_NAME_SYM
4828 4 { $$= Condition_information_item::COLUMN_NAME; }
4829 | CURSOR_NAME_SYM
4830 4 { $$= Condition_information_item::CURSOR_NAME; }
4831 | MESSAGE_TEXT_SYM
4832 670 { $$= Condition_information_item::MESSAGE_TEXT; }
4833 | MYSQL_ERRNO_SYM
4834 622 { $$= Condition_information_item::MYSQL_ERRNO; }
4835 | RETURNED_SQLSTATE_SYM
4836 12 { $$= Condition_information_item::RETURNED_SQLSTATE; }
4837 ;
4838
4839 sp_decl_idents:
4840 ident
4841 {
4842 /* NOTE: field definition is filled in sp_decl section. */
4843
4844 100376 THD *thd= YYTHD;
4845 100376 LEX *lex= thd->lex;
4846 100376 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4847
4848
3/4
✓ Branch 0 taken 100378 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 100377 times.
100376 if (pctx->find_variable($1.str, $1.length, true))
4849 {
4850
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_DUP_VAR, MYF(0), $1.str);
4851 1 MYSQL_YYABORT;
4852 }
4853
4854
1/2
✓ Branch 0 taken 100377 times.
✗ Branch 1 not taken.
100377 pctx->add_variable(thd,
4855 $1,
4856 MYSQL_TYPE_DECIMAL,
4857 sp_variable::MODE_IN);
4858 100377 $$= 1;
4859 }
4860 | sp_decl_idents ',' ident
4861 {
4862 /* NOTE: field definition is filled in sp_decl section. */
4863
4864 13025 THD *thd= YYTHD;
4865 13025 LEX *lex= thd->lex;
4866 13025 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4867
4868
2/4
✓ Branch 0 taken 13025 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 13025 times.
13025 if (pctx->find_variable($3.str, $3.length, true))
4869 {
4870 my_error(ER_SP_DUP_VAR, MYF(0), $3.str);
4871 MYSQL_YYABORT;
4872 }
4873
4874
1/2
✓ Branch 0 taken 13025 times.
✗ Branch 1 not taken.
13025 pctx->add_variable(thd,
4875 $3,
4876 MYSQL_TYPE_DECIMAL,
4877 sp_variable::MODE_IN);
4878 13025 $$= $1 + 1;
4879 }
4880 ;
4881
4882 sp_opt_default:
4883 /* Empty */
4884 {
4885 63197 $$.expr_start= NULL;
4886 63197 $$.expr = NULL;
4887 }
4888 | DEFAULT_SYM expr
4889 {
4890 37157 $$.expr_start= @1.raw.end;
4891 37157 $$.expr= $2;
4892 }
4893 ;
4894
4895 sp_proc_stmt:
4896 sp_proc_stmt_statement
4897 | sp_proc_stmt_return
4898 | sp_proc_stmt_if
4899 | case_stmt_specification
4900 | sp_labeled_block
4901 | sp_unlabeled_block
4902 | sp_labeled_control
4903 | sp_proc_stmt_unlabeled
4904 | sp_proc_stmt_leave
4905 | sp_proc_stmt_iterate
4906 | sp_proc_stmt_open
4907 | sp_proc_stmt_fetch
4908 | sp_proc_stmt_close
4909 ;
4910
4911 sp_proc_stmt_if:
4912 IF
4913 254466 { Lex->sphead->m_parser_data.new_cont_backpatch(); }
4914 sp_if END IF
4915 {
4916 254397 sp_head *sp= Lex->sphead;
4917
4918
2/4
✓ Branch 0 taken 254397 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 254397 times.
✗ Branch 3 not taken.
254397 sp->m_parser_data.do_cont_backpatch(sp->instructions());
4919 }
4920 ;
4921
4922 sp_proc_stmt_statement:
4923 {
4924 1765273 THD *thd= YYTHD;
4925 1765273 LEX *lex= thd->lex;
4926 1765273 sp_head *sp= lex->sphead;
4927
4928
1/2
✓ Branch 0 taken 1765283 times.
✗ Branch 1 not taken.
1765273 sp->reset_lex(thd);
4929 1765283 sp->m_parser_data.set_current_stmt_start_ptr(yylloc.raw.start);
4930 }
4931 simple_statement
4932 {
4933
2/2
✓ Branch 0 taken 1182106 times.
✓ Branch 1 taken 582613 times.
1764719 if ($2 != nullptr)
4934
7/10
✓ Branch 0 taken 1182107 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1182107 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1182102 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 171 times.
✓ Branch 7 taken 1181931 times.
✓ Branch 8 taken 172 times.
✓ Branch 9 taken 1181930 times.
1182106 MAKE_CMD($2);
4935
4936 1764543 THD *thd= YYTHD;
4937 1764543 LEX *lex= thd->lex;
4938 1764543 sp_head *sp= lex->sphead;
4939
4940
1/2
✓ Branch 0 taken 1764542 times.
✗ Branch 1 not taken.
1764543 sp->m_flags|= sp_get_flags_for_command(lex);
4941
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1764540 times.
1764542 if (lex->sql_command == SQLCOM_CHANGE_DB)
4942 { /* "USE db" doesn't work in a procedure */
4943
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_BADSTATEMENT, MYF(0), "USE");
4944 2 MYSQL_YYABORT;
4945 }
4946
4947 // Mark statement as belonging to a stored procedure:
4948
2/2
✓ Branch 0 taken 1195767 times.
✓ Branch 1 taken 568773 times.
1764540 if (lex->m_sql_cmd != NULL)
4949 1195767 lex->m_sql_cmd->set_as_part_of_sp();
4950
4951 /*
4952 Don't add an instruction for SET statements, since all
4953 instructions for them were already added during processing
4954 of "set" rule.
4955 */
4956
4/6
✓ Branch 0 taken 1339168 times.
✓ Branch 1 taken 425369 times.
✓ Branch 2 taken 1339168 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 425370 times.
1764537 assert((lex->sql_command != SQLCOM_SET_OPTION &&
4957 lex->sql_command != SQLCOM_SET_PASSWORD) ||
4958 lex->var_list.is_empty());
4959
2/2
✓ Branch 0 taken 1339170 times.
✓ Branch 1 taken 425368 times.
1764538 if (lex->sql_command != SQLCOM_SET_OPTION &&
4960
1/2
✓ Branch 0 taken 1339172 times.
✗ Branch 1 not taken.
1339170 lex->sql_command != SQLCOM_SET_PASSWORD)
4961 {
4962 /* Extract the query statement from the tokenizer. */
4963
4964 LEX_CSTRING query=
4965
1/2
✓ Branch 0 taken 1339172 times.
✗ Branch 1 not taken.
1339172 make_string(thd,
4966 sp->m_parser_data.get_current_stmt_start_ptr(),
4967 @2.raw.end);
4968
4969
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1339172 times.
1339172 if (!query.str)
4970 MYSQL_YYABORT;
4971
4972 /* Add instruction. */
4973
4974 sp_instr_stmt *i=
4975
3/6
✓ Branch 0 taken 1339172 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1339173 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1339174 times.
✗ Branch 5 not taken.
1339172 NEW_PTN sp_instr_stmt(sp->instructions(), lex, query);
4976
4977
4/8
✓ Branch 0 taken 1339174 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1339175 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1339175 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1339175 times.
1339174 if (!i || sp->add_instr(thd, i))
4978 MYSQL_YYABORT;
4979 }
4980
4981
2/4
✓ Branch 0 taken 1764544 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1764544 times.
1764541 if (sp->restore_lex(thd))
4982 MYSQL_YYABORT;
4983 }
4984 ;
4985
4986 sp_proc_stmt_return:
4987 RETURN_SYM /*$1*/
4988 { /*$2*/
4989 103694 THD *thd= YYTHD;
4990 103694 LEX *lex= thd->lex;
4991 103694 sp_head *sp= lex->sphead;
4992
4993
1/2
✓ Branch 0 taken 103694 times.
✗ Branch 1 not taken.
103694 sp->reset_lex(thd);
4994 }
4995 expr /*$3*/
4996 { /*$4*/
4997
10/14
✓ Branch 0 taken 103693 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 103693 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 103692 times.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 103692 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 103692 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 4 times.
✓ Branch 11 taken 103688 times.
✓ Branch 12 taken 5 times.
✓ Branch 13 taken 103688 times.
103693 ITEMIZE($3, &$3);
4998
4999 103688 THD *thd= YYTHD;
5000 103688 LEX *lex= thd->lex;
5001 103688 sp_head *sp= lex->sphead;
5002
5003 /* Extract expression string. */
5004
5005 103688 LEX_CSTRING expr_query= EMPTY_CSTR;
5006
5007 103688 const char *expr_start_ptr= @1.raw.end;
5008
5009
2/2
✓ Branch 0 taken 6968 times.
✓ Branch 1 taken 96720 times.
103688 if (lex->is_metadata_used())
5010 {
5011
1/2
✓ Branch 0 taken 6968 times.
✗ Branch 1 not taken.
6968 expr_query= make_string(thd, expr_start_ptr, @3.raw.end);
5012
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6968 times.
6968 if (!expr_query.str)
5013 MYSQL_YYABORT;
5014 }
5015
5016 /* Check that this is a stored function. */
5017
5018
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 103686 times.
103688 if (sp->m_type != enum_sp_type::FUNCTION)
5019 {
5020
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_BADRETURN, MYF(0));
5021 2 MYSQL_YYABORT;
5022 }
5023
5024 /* Indicate that we've reached RETURN statement. */
5025
5026 103686 sp->m_flags|= sp_head::HAS_RETURN;
5027
5028 /* Add instruction. */
5029
5030 sp_instr_freturn *i=
5031
1/2
✓ Branch 0 taken 103686 times.
✗ Branch 1 not taken.
103686 NEW_PTN sp_instr_freturn(sp->instructions(), lex, $3, expr_query,
5032
2/4
✓ Branch 0 taken 103686 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 103686 times.
✗ Branch 3 not taken.
103686 sp->m_return_field_def.sql_type);
5033
5034 207372 if (i == NULL ||
5035
4/8
✓ Branch 0 taken 103686 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 103686 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 103686 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 103686 times.
207372 sp->add_instr(thd, i) ||
5036
2/4
✓ Branch 0 taken 103686 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 103686 times.
103686 sp->restore_lex(thd))
5037 {
5038 MYSQL_YYABORT;
5039 }
5040 }
5041 ;
5042
5043 sp_proc_stmt_unlabeled:
5044 { /* Unlabeled controls get a secret label. */
5045 6498 THD *thd= YYTHD;
5046 6498 LEX *lex= thd->lex;
5047 6498 sp_head *sp= lex->sphead;
5048 6498 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5049
5050
2/4
✓ Branch 0 taken 6497 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6499 times.
✗ Branch 3 not taken.
6497 pctx->push_label(thd,
5051 EMPTY_CSTR,
5052 sp->instructions());
5053 }
5054 sp_unlabeled_control
5055 {
5056 6423 LEX *lex= Lex;
5057 6423 sp_head *sp= lex->sphead;
5058 6423 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5059
5060
3/6
✓ Branch 0 taken 6423 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6423 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6423 times.
✗ Branch 5 not taken.
6423 sp->m_parser_data.do_backpatch(pctx->pop_label(),
5061 sp->instructions());
5062 }
5063 ;
5064
5065 sp_proc_stmt_leave:
5066 LEAVE_SYM label_ident
5067 {
5068 4402 THD *thd= YYTHD;
5069 4402 LEX *lex= Lex;
5070 4402 sp_head *sp = lex->sphead;
5071 4402 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5072
1/2
✓ Branch 0 taken 4402 times.
✗ Branch 1 not taken.
4402 sp_label *lab= pctx->find_label($2);
5073
5074
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4398 times.
4402 if (! lab)
5075 {
5076
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "LEAVE", $2.str);
5077 4 MYSQL_YYABORT;
5078 }
5079
5080
1/2
✓ Branch 0 taken 4398 times.
✗ Branch 1 not taken.
4398 uint ip= sp->instructions();
5081
5082 /*
5083 When jumping to a BEGIN-END block end, the target jump
5084 points to the block hpop/cpop cleanup instructions,
5085 so we should exclude the block context here.
5086 When jumping to something else (i.e., sp_label::ITERATION),
5087 there are no hpop/cpop at the jump destination,
5088 so we should include the block context here for cleanup.
5089 */
5090 4398 bool exclusive= (lab->type == sp_label::BEGIN);
5091
5092
1/2
✓ Branch 0 taken 4398 times.
✗ Branch 1 not taken.
4398 size_t n= pctx->diff_handlers(lab->ctx, exclusive);
5093
5094
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4394 times.
4398 if (n)
5095 {
5096
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 sp_instr_hpop *hpop= NEW_PTN sp_instr_hpop(ip++, pctx);
5097
5098
4/8
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
4 if (!hpop || sp->add_instr(thd, hpop))
5099 MYSQL_YYABORT;
5100 }
5101
5102
1/2
✓ Branch 0 taken 4398 times.
✗ Branch 1 not taken.
4398 n= pctx->diff_cursors(lab->ctx, exclusive);
5103
5104
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 4396 times.
4398 if (n)
5105 {
5106
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 sp_instr_cpop *cpop= NEW_PTN sp_instr_cpop(ip++, pctx, n);
5107
5108
4/8
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
2 if (!cpop || sp->add_instr(thd, cpop))
5109 MYSQL_YYABORT;
5110 }
5111
5112
1/2
✓ Branch 0 taken 4398 times.
✗ Branch 1 not taken.
4398 sp_instr_jump *i= NEW_PTN sp_instr_jump(ip, pctx);
5113
5114 8796 if (!i ||
5115 /* Jumping forward */
5116
5/10
✓ Branch 0 taken 4398 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4398 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4398 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4398 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 4398 times.
8796 sp->m_parser_data.add_backpatch_entry(i, lab) ||
5117
2/4
✓ Branch 0 taken 4398 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4398 times.
4398 sp->add_instr(thd, i))
5118 MYSQL_YYABORT;
5119 }
5120 ;
5121
5122 sp_proc_stmt_iterate:
5123 ITERATE_SYM label_ident
5124 {
5125 67 THD *thd= YYTHD;
5126 67 LEX *lex= Lex;
5127 67 sp_head *sp= lex->sphead;
5128 67 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5129
1/2
✓ Branch 0 taken 67 times.
✗ Branch 1 not taken.
67 sp_label *lab= pctx->find_label($2);
5130
5131
4/4
✓ Branch 0 taken 61 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 60 times.
67 if (! lab || lab->type != sp_label::ITERATION)
5132 {
5133
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "ITERATE", $2.str);
5134 7 MYSQL_YYABORT;
5135 }
5136
5137
1/2
✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
60 uint ip= sp->instructions();
5138
5139 /* Inclusive the dest. */
5140
1/2
✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
60 size_t n= pctx->diff_handlers(lab->ctx, false);
5141
5142
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 56 times.
60 if (n)
5143 {
5144
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 sp_instr_hpop *hpop= NEW_PTN sp_instr_hpop(ip++, pctx);
5145
5146
4/8
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
4 if (!hpop || sp->add_instr(thd, hpop))
5147 MYSQL_YYABORT;
5148 }
5149
5150 /* Inclusive the dest. */
5151
1/2
✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
60 n= pctx->diff_cursors(lab->ctx, false);
5152
5153
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 56 times.
60 if (n)
5154 {
5155
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 sp_instr_cpop *cpop= NEW_PTN sp_instr_cpop(ip++, pctx, n);
5156
5157
4/8
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
4 if (!cpop || sp->add_instr(thd, cpop))
5158 MYSQL_YYABORT;
5159 }
5160
5161 /* Jump back */
5162
1/2
✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
60 sp_instr_jump *i= NEW_PTN sp_instr_jump(ip, pctx, lab->ip);
5163
5164
4/8
✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 60 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 60 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 60 times.
60 if (!i || sp->add_instr(thd, i))
5165 MYSQL_YYABORT;
5166 }
5167 ;
5168
5169 sp_proc_stmt_open:
5170 OPEN_SYM ident
5171 {
5172 5428 THD *thd= YYTHD;
5173 5428 LEX *lex= Lex;
5174 5428 sp_head *sp= lex->sphead;
5175 5428 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5176 uint offset;
5177
5178
3/4
✓ Branch 0 taken 5428 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 5426 times.
5428 if (! pctx->find_cursor($2, &offset, false))
5179 {
5180
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
5181 2 MYSQL_YYABORT;
5182 }
5183
5184
1/2
✓ Branch 0 taken 5426 times.
✗ Branch 1 not taken.
5426 sp_instr_copen *i= NEW_PTN sp_instr_copen(sp->instructions(), pctx,
5185
1/2
✓ Branch 0 taken 5426 times.
✗ Branch 1 not taken.
5426 offset);
5186
5187
4/8
✓ Branch 0 taken 5426 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5426 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5426 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5426 times.
5426 if (!i || sp->add_instr(thd, i))
5188 MYSQL_YYABORT;
5189 }
5190 ;
5191
5192 sp_proc_stmt_fetch:
5193 FETCH_SYM sp_opt_fetch_noise ident INTO
5194 {
5195 5512 THD *thd= YYTHD;
5196 5512 LEX *lex= Lex;
5197 5512 sp_head *sp= lex->sphead;
5198 5512 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5199 uint offset;
5200
5201
2/4
✓ Branch 0 taken 5512 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5512 times.
5512 if (! pctx->find_cursor($3, &offset, false))
5202 {
5203 my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $3.str);
5204 MYSQL_YYABORT;
5205 }
5206
5207
1/2
✓ Branch 0 taken 5512 times.
✗ Branch 1 not taken.
5512 sp_instr_cfetch *i= NEW_PTN sp_instr_cfetch(sp->instructions(),
5208
2/4
✓ Branch 0 taken 5512 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5512 times.
✗ Branch 3 not taken.
5512 pctx, offset);
5209
5210
4/8
✓ Branch 0 taken 5512 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5512 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5512 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5512 times.
5512 if (!i || sp->add_instr(thd, i))
5211 MYSQL_YYABORT;
5212 }
5213 sp_fetch_list
5214 {}
5215 ;
5216
5217 sp_proc_stmt_close:
5218 CLOSE_SYM ident
5219 {
5220 5373 THD *thd= YYTHD;
5221 5373 LEX *lex= Lex;
5222 5373 sp_head *sp= lex->sphead;
5223 5373 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5224 uint offset;
5225
5226
2/4
✓ Branch 0 taken 5373 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5373 times.
5373 if (! pctx->find_cursor($2, &offset, false))
5227 {
5228 my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
5229 MYSQL_YYABORT;
5230 }
5231
5232 sp_instr_cclose *i=
5233
2/4
✓ Branch 0 taken 5373 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5373 times.
✗ Branch 3 not taken.
5373 NEW_PTN sp_instr_cclose(sp->instructions(), pctx, offset);
5234
5235
4/8
✓ Branch 0 taken 5373 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5373 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5373 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5373 times.
5373 if (!i || sp->add_instr(thd, i))
5236 MYSQL_YYABORT;
5237 }
5238 ;
5239
5240 sp_opt_fetch_noise:
5241 /* Empty */
5242 | NEXT_SYM FROM
5243 | FROM
5244 ;
5245
5246 sp_fetch_list:
5247 ident
5248 {
5249 5512 LEX *lex= Lex;
5250 5512 sp_head *sp= lex->sphead;
5251 5512 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5252 sp_variable *spv;
5253
5254
4/8
✓ Branch 0 taken 5512 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5512 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5512 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5512 times.
5512 if (!pctx || !(spv= pctx->find_variable($1.str, $1.length, false)))
5255 {
5256 my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
5257 MYSQL_YYABORT;
5258 }
5259
5260 /* An SP local variable */
5261
1/2
✓ Branch 0 taken 5512 times.
✗ Branch 1 not taken.
5512 sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction();
5262
5263
1/2
✓ Branch 0 taken 5512 times.
✗ Branch 1 not taken.
5512 i->add_to_varlist(spv);
5264 }
5265 | sp_fetch_list ',' ident
5266 {
5267 2465 LEX *lex= Lex;
5268 2465 sp_head *sp= lex->sphead;
5269 2465 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5270 sp_variable *spv;
5271
5272
6/8
✓ Branch 0 taken 2465 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2465 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 2464 times.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 2464 times.
2465 if (!pctx || !(spv= pctx->find_variable($3.str, $3.length, false)))
5273 {
5274
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_UNDECLARED_VAR, MYF(0), $3.str);
5275 1 MYSQL_YYABORT;
5276 }
5277
5278 /* An SP local variable */
5279
1/2
✓ Branch 0 taken 2464 times.
✗ Branch 1 not taken.
2464 sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction();
5280
5281
1/2
✓ Branch 0 taken 2464 times.
✗ Branch 1 not taken.
2464 i->add_to_varlist(spv);
5282 }
5283 ;
5284
5285 sp_if:
5286 { /*$1*/
5287 286672 THD *thd= YYTHD;
5288 286672 LEX *lex= thd->lex;
5289 286672 sp_head *sp= lex->sphead;
5290
5291
1/2
✓ Branch 0 taken 286673 times.
✗ Branch 1 not taken.
286672 sp->reset_lex(thd);
5292 }
5293 expr /*$2*/
5294 { /*$3*/
5295
7/14
✓ Branch 0 taken 286671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 286671 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 286671 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 286671 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 286671 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 286671 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 286671 times.
286671 ITEMIZE($2, &$2);
5296
5297 286671 THD *thd= YYTHD;
5298 286671 LEX *lex= Lex;
5299 286671 sp_head *sp= lex->sphead;
5300 286671 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5301
5302 /* Extract expression string. */
5303
5304 286671 LEX_CSTRING expr_query= EMPTY_CSTR;
5305 286671 const char *expr_start_ptr= @0.raw.end;
5306
5307
2/2
✓ Branch 0 taken 101124 times.
✓ Branch 1 taken 185547 times.
286671 if (lex->is_metadata_used())
5308 {
5309
1/2
✓ Branch 0 taken 101124 times.
✗ Branch 1 not taken.
101124 expr_query= make_string(thd, expr_start_ptr, @2.raw.end);
5310
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 101124 times.
101124 if (!expr_query.str)
5311 MYSQL_YYABORT;
5312 }
5313
5314 sp_instr_jump_if_not *i =
5315
1/2
✓ Branch 0 taken 286671 times.
✗ Branch 1 not taken.
286671 NEW_PTN sp_instr_jump_if_not(sp->instructions(), lex,
5316
2/4
✓ Branch 0 taken 286671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 286671 times.
✗ Branch 3 not taken.
286671 $2, expr_query);
5317
5318 /* Add jump instruction. */
5319
5320 573342 if (i == NULL ||
5321
4/8
✓ Branch 0 taken 286671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 286671 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 286671 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 286671 times.
✗ Branch 7 not taken.
286671 sp->m_parser_data.add_backpatch_entry(
5322 286671 i, pctx->push_label(thd, EMPTY_CSTR, 0)) ||
5323
2/4
✓ Branch 0 taken 286671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 286671 times.
✗ Branch 3 not taken.
286671 sp->m_parser_data.add_cont_backpatch_entry(i) ||
5324
4/8
✓ Branch 0 taken 286671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 286671 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 286671 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 286671 times.
860013 sp->add_instr(thd, i) ||
5325
2/4
✓ Branch 0 taken 286671 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 286671 times.
286671 sp->restore_lex(thd))
5326 {
5327 MYSQL_YYABORT;
5328 }
5329 }
5330 THEN_SYM /*$4*/
5331 sp_proc_stmts1 /*$5*/
5332 { /*$6*/
5333 286607 THD *thd= YYTHD;
5334 286607 LEX *lex= thd->lex;
5335 286607 sp_head *sp= lex->sphead;
5336 286607 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5337
5338
2/4
✓ Branch 0 taken 286607 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 286607 times.
✗ Branch 3 not taken.
286607 sp_instr_jump *i = NEW_PTN sp_instr_jump(sp->instructions(), pctx);
5339
5340
4/8
✓ Branch 0 taken 286607 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 286607 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 286607 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 286607 times.
286607 if (!i || sp->add_instr(thd, i))
5341 MYSQL_YYABORT;
5342
5343
3/6
✓ Branch 0 taken 286607 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 286607 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 286607 times.
✗ Branch 5 not taken.
286607 sp->m_parser_data.do_backpatch(pctx->pop_label(),
5344 sp->instructions());
5345
5346
3/6
✓ Branch 0 taken 286607 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 286607 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 286607 times.
✗ Branch 5 not taken.
286607 sp->m_parser_data.add_backpatch_entry(
5347 i, pctx->push_label(thd, EMPTY_CSTR, 0));
5348 }
5349 sp_elseifs /*$7*/
5350 { /*$8*/
5351 286606 LEX *lex= Lex;
5352 286606 sp_head *sp= lex->sphead;
5353 286606 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5354
5355
3/6
✓ Branch 0 taken 286606 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 286606 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 286606 times.
✗ Branch 5 not taken.
286606 sp->m_parser_data.do_backpatch(pctx->pop_label(),
5356 sp->instructions());
5357 }
5358 ;
5359
5360 sp_elseifs:
5361 /* Empty */
5362 | ELSEIF_SYM sp_if
5363 | ELSE sp_proc_stmts1
5364 ;
5365
5366 case_stmt_specification:
5367 simple_case_stmt
5368 | searched_case_stmt
5369 ;
5370
5371 simple_case_stmt:
5372 CASE_SYM /*$1*/
5373 { /*$2*/
5374 600 THD *thd= YYTHD;
5375 600 LEX *lex= thd->lex;
5376 600 sp_head *sp= lex->sphead;
5377
5378
1/2
✓ Branch 0 taken 600 times.
✗ Branch 1 not taken.
600 case_stmt_action_case(thd);
5379
5380
1/2
✓ Branch 0 taken 600 times.
✗ Branch 1 not taken.
600 sp->reset_lex(thd); /* For CASE-expr $3 */
5381 }
5382 expr /*$3*/
5383 { /*$4*/
5384
7/14
✓ Branch 0 taken 598 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 598 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 598 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 598 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 598 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 598 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 598 times.
598 ITEMIZE($3, &$3);
5385
5386 598 THD *thd= YYTHD;
5387 598 LEX *lex= Lex;
5388 598 sp_head *sp= lex->sphead;
5389
5390 /* Extract CASE-expression string. */
5391
5392 598 LEX_CSTRING case_expr_query= EMPTY_CSTR;
5393 598 const char *expr_start_ptr= @1.raw.end;
5394
5395
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 578 times.
598 if (lex->is_metadata_used())
5396 {
5397
1/2
✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
20 case_expr_query= make_string(thd, expr_start_ptr, @3.raw.end);
5398
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
20 if (!case_expr_query.str)
5399 MYSQL_YYABORT;
5400 }
5401
5402 /* Register new CASE-expression and get its id. */
5403
5404 598 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5405
1/2
✓ Branch 0 taken 598 times.
✗ Branch 1 not taken.
598 int case_expr_id= pctx->push_case_expr_id();
5406
5407
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 598 times.
598 if (case_expr_id < 0)
5408 MYSQL_YYABORT;
5409
5410 /* Add CASE-set instruction. */
5411
5412 sp_instr_set_case_expr *i=
5413
1/2
✓ Branch 0 taken 598 times.
✗ Branch 1 not taken.
598 NEW_PTN sp_instr_set_case_expr(sp->instructions(), lex,
5414
2/4
✓ Branch 0 taken 598 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 598 times.
✗ Branch 3 not taken.
598 case_expr_id, $3, case_expr_query);
5415
5416 1196 if (i == NULL ||
5417
2/4
✓ Branch 0 taken 598 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 598 times.
✗ Branch 3 not taken.
598 sp->m_parser_data.add_cont_backpatch_entry(i) ||
5418
4/8
✓ Branch 0 taken 598 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 598 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 598 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 598 times.
1794 sp->add_instr(thd, i) ||
5419
2/4
✓ Branch 0 taken 598 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 598 times.
598 sp->restore_lex(thd))
5420 {
5421 MYSQL_YYABORT;
5422 }
5423 }
5424 simple_when_clause_list /*$5*/
5425 else_clause_opt /*$6*/
5426 END /*$7*/
5427 CASE_SYM /*$8*/
5428 { /*$9*/
5429
1/2
✓ Branch 0 taken 596 times.
✗ Branch 1 not taken.
596 case_stmt_action_end_case(Lex, true);
5430 }
5431 ;
5432
5433 searched_case_stmt:
5434 CASE_SYM
5435 {
5436
1/2
✓ Branch 0 taken 584 times.
✗ Branch 1 not taken.
584 case_stmt_action_case(YYTHD);
5437 }
5438 searched_when_clause_list
5439 else_clause_opt
5440 END
5441 CASE_SYM
5442 {
5443
1/2
✓ Branch 0 taken 580 times.
✗ Branch 1 not taken.
580 case_stmt_action_end_case(Lex, false);
5444 }
5445 ;
5446
5447 simple_when_clause_list:
5448 simple_when_clause
5449 | simple_when_clause_list simple_when_clause
5450 ;
5451
5452 searched_when_clause_list:
5453 searched_when_clause
5454 | searched_when_clause_list searched_when_clause
5455 ;
5456
5457 simple_when_clause:
5458 WHEN_SYM /*$1*/
5459 { /*$2*/
5460 21713 THD *thd= YYTHD;
5461 21713 LEX *lex= thd->lex;
5462 21713 sp_head *sp= lex->sphead;
5463
5464
1/2
✓ Branch 0 taken 21713 times.
✗ Branch 1 not taken.
21713 sp->reset_lex(thd);
5465 }
5466 expr /*$3*/
5467 { /*$4*/
5468 /* Simple case: <caseval> = <whenval> */
5469
5470
7/14
✓ Branch 0 taken 21713 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21713 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21713 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 21713 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 21713 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 21713 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 21713 times.
21713 ITEMIZE($3, &$3);
5471
5472 21713 THD *thd= YYTHD;
5473 21713 LEX *lex= thd->lex;
5474 21713 sp_head *sp= lex->sphead;
5475 21713 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5476
5477 /* Extract expression string. */
5478
5479 21713 LEX_CSTRING when_expr_query= EMPTY_CSTR;
5480 21713 const char *expr_start_ptr= @1.raw.end;
5481
5482
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 21711 times.
21713 if (lex->is_metadata_used())
5483 {
5484
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 when_expr_query= make_string(thd, expr_start_ptr, @3.raw.end);
5485
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (!when_expr_query.str)
5486 MYSQL_YYABORT;
5487 }
5488
5489 /* Add CASE-when-jump instruction. */
5490
5491 sp_instr_jump_case_when *i =
5492
1/2
✓ Branch 0 taken 21713 times.
✗ Branch 1 not taken.
21713 NEW_PTN sp_instr_jump_case_when(sp->instructions(), lex,
5493
1/2
✓ Branch 0 taken 21713 times.
✗ Branch 1 not taken.
21713 pctx->get_current_case_expr_id(),
5494
2/4
✓ Branch 0 taken 21713 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21713 times.
✗ Branch 3 not taken.
21713 $3, when_expr_query);
5495
5496 43426 if (i == NULL ||
5497
2/4
✓ Branch 0 taken 21713 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21713 times.
✗ Branch 3 not taken.
21713 i->on_after_expr_parsing(thd) ||
5498
4/8
✓ Branch 0 taken 21713 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21713 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21713 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 21713 times.
✗ Branch 7 not taken.
21713 sp->m_parser_data.add_backpatch_entry(
5499 21713 i, pctx->push_label(thd, EMPTY_CSTR, 0)) ||
5500
2/4
✓ Branch 0 taken 21713 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21713 times.
✗ Branch 3 not taken.
21713 sp->m_parser_data.add_cont_backpatch_entry(i) ||
5501
4/8
✓ Branch 0 taken 21713 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21713 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21713 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 21713 times.
65139 sp->add_instr(thd, i) ||
5502
2/4
✓ Branch 0 taken 21713 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 21713 times.
21713 sp->restore_lex(thd))
5503 {
5504 MYSQL_YYABORT;
5505 }
5506 }
5507 THEN_SYM /*$5*/
5508 sp_proc_stmts1 /*$6*/
5509 { /*$7*/
5510
2/4
✓ Branch 0 taken 21712 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 21712 times.
21712 if (case_stmt_action_then(YYTHD, Lex))
5511 MYSQL_YYABORT;
5512 }
5513 ;
5514
5515 searched_when_clause:
5516 WHEN_SYM /*$1*/
5517 { /*$2*/
5518 2756 THD *thd= YYTHD;
5519 2756 LEX *lex= thd->lex;
5520 2756 sp_head *sp= lex->sphead;
5521
5522
1/2
✓ Branch 0 taken 2756 times.
✗ Branch 1 not taken.
2756 sp->reset_lex(thd);
5523 }
5524 expr /*$3*/
5525 { /*$4*/
5526
7/14
✓ Branch 0 taken 2756 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2756 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2756 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2756 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2756 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2756 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 2756 times.
2756 ITEMIZE($3, &$3);
5527
5528 2756 THD *thd= YYTHD;
5529 2756 LEX *lex= thd->lex;
5530 2756 sp_head *sp= lex->sphead;
5531 2756 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5532
5533 /* Extract expression string. */
5534
5535 2756 LEX_CSTRING when_query= EMPTY_CSTR;
5536 2756 const char *expr_start_ptr= @1.raw.end;
5537
5538
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 2738 times.
2756 if (lex->is_metadata_used())
5539 {
5540
1/2
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
18 when_query= make_string(thd, expr_start_ptr, @3.raw.end);
5541
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
18 if (!when_query.str)
5542 MYSQL_YYABORT;
5543 }
5544
5545 /* Add jump instruction. */
5546
5547 sp_instr_jump_if_not *i=
5548
1/2
✓ Branch 0 taken 2756 times.
✗ Branch 1 not taken.
2756 NEW_PTN sp_instr_jump_if_not(sp->instructions(), lex, $3,
5549
2/4
✓ Branch 0 taken 2756 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2756 times.
✗ Branch 3 not taken.
2756 when_query);
5550
5551 5512 if (i == NULL ||
5552
4/8
✓ Branch 0 taken 2756 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2756 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2756 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2756 times.
✗ Branch 7 not taken.
2756 sp->m_parser_data.add_backpatch_entry(
5553 2756 i, pctx->push_label(thd, EMPTY_CSTR, 0)) ||
5554
2/4
✓ Branch 0 taken 2756 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2756 times.
✗ Branch 3 not taken.
2756 sp->m_parser_data.add_cont_backpatch_entry(i) ||
5555
4/8
✓ Branch 0 taken 2756 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2756 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2756 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2756 times.
8268 sp->add_instr(thd, i) ||
5556
2/4
✓ Branch 0 taken 2756 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2756 times.
2756 sp->restore_lex(thd))
5557 {
5558 MYSQL_YYABORT;
5559 }
5560 }
5561 THEN_SYM /*$6*/
5562 sp_proc_stmts1 /*$7*/
5563 { /*$8*/
5564
2/4
✓ Branch 0 taken 2755 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2755 times.
2755 if (case_stmt_action_then(YYTHD, Lex))
5565 MYSQL_YYABORT;
5566 }
5567 ;
5568
5569 else_clause_opt:
5570 /* empty */
5571 {
5572 84 THD *thd= YYTHD;
5573 84 LEX *lex= Lex;
5574 84 sp_head *sp= lex->sphead;
5575 84 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5576
5577 sp_instr_error *i=
5578 NEW_PTN
5579
2/4
✓ Branch 0 taken 84 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 84 times.
✗ Branch 3 not taken.
84 sp_instr_error(sp->instructions(), pctx, ER_SP_CASE_NOT_FOUND);
5580
5581
4/8
✓ Branch 0 taken 84 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 84 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 84 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 84 times.
84 if (!i || sp->add_instr(thd, i))
5582 MYSQL_YYABORT;
5583 }
5584 | ELSE sp_proc_stmts1
5585 ;
5586
5587 sp_labeled_control:
5588 label_ident ':'
5589 {
5590 4542 LEX *lex= Lex;
5591 4542 sp_head *sp= lex->sphead;
5592 4542 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5593
1/2
✓ Branch 0 taken 4542 times.
✗ Branch 1 not taken.
4542 sp_label *lab= pctx->find_label($1);
5594
5595
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 4539 times.
4542 if (lab)
5596 {
5597
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_SP_LABEL_REDEFINE, MYF(0), $1.str);
5598 3 MYSQL_YYABORT;
5599 }
5600 else
5601 {
5602
2/4
✓ Branch 0 taken 4539 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4539 times.
✗ Branch 3 not taken.
4539 lab= pctx->push_label(YYTHD, $1, sp->instructions());
5603 4539 lab->type= sp_label::ITERATION;
5604 }
5605 }
5606 sp_unlabeled_control sp_opt_label
5607 {
5608 4504 LEX *lex= Lex;
5609 4504 sp_head *sp= lex->sphead;
5610 4504 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5611
1/2
✓ Branch 0 taken 4504 times.
✗ Branch 1 not taken.
4504 sp_label *lab= pctx->pop_label();
5612
5613
2/2
✓ Branch 0 taken 142 times.
✓ Branch 1 taken 4362 times.
4504 if ($5.str)
5614 {
5615
3/4
✓ Branch 0 taken 142 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 135 times.
142 if (my_strcasecmp(system_charset_info, $5.str, lab->name.str) != 0)
5616 {
5617
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 my_error(ER_SP_LABEL_MISMATCH, MYF(0), $5.str);
5618 7 MYSQL_YYABORT;
5619 }
5620 }
5621
2/4
✓ Branch 0 taken 4497 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4497 times.
✗ Branch 3 not taken.
4497 sp->m_parser_data.do_backpatch(lab, sp->instructions());
5622 }
5623 ;
5624
5625 sp_opt_label:
5626 4397 /* Empty */ { $$= NULL_CSTR; }
5627 221 | label_ident { $$= $1; }
5628 ;
5629
5630 sp_labeled_block:
5631 label_ident ':'
5632 {
5633 125 LEX *lex= Lex;
5634 125 sp_head *sp= lex->sphead;
5635 125 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5636
1/2
✓ Branch 0 taken 125 times.
✗ Branch 1 not taken.
125 sp_label *lab= pctx->find_label($1);
5637
5638
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 124 times.
125 if (lab)
5639 {
5640
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_LABEL_REDEFINE, MYF(0), $1.str);
5641 1 MYSQL_YYABORT;
5642 }
5643
5644
2/4
✓ Branch 0 taken 124 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 124 times.
✗ Branch 3 not taken.
124 lab= pctx->push_label(YYTHD, $1, sp->instructions());
5645 124 lab->type= sp_label::BEGIN;
5646 }
5647 sp_block_content sp_opt_label
5648 {
5649 114 LEX *lex= Lex;
5650 114 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5651
1/2
✓ Branch 0 taken 114 times.
✗ Branch 1 not taken.
114 sp_label *lab= pctx->pop_label();
5652
5653
2/2
✓ Branch 0 taken 79 times.
✓ Branch 1 taken 35 times.
114 if ($5.str)
5654 {
5655
3/4
✓ Branch 0 taken 79 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 77 times.
79 if (my_strcasecmp(system_charset_info, $5.str, lab->name.str) != 0)
5656 {
5657
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_LABEL_MISMATCH, MYF(0), $5.str);
5658 2 MYSQL_YYABORT;
5659 }
5660 }
5661 }
5662 ;
5663
5664 sp_unlabeled_block:
5665 { /* Unlabeled blocks get a secret label. */
5666 344675 LEX *lex= Lex;
5667 344675 sp_head *sp= lex->sphead;
5668 344675 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5669
5670 sp_label *lab=
5671
2/4
✓ Branch 0 taken 344676 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 344676 times.
✗ Branch 3 not taken.
344675 pctx->push_label(YYTHD, EMPTY_CSTR, sp->instructions());
5672
5673 344676 lab->type= sp_label::BEGIN;
5674 }
5675 sp_block_content
5676 {
5677 343364 LEX *lex= Lex;
5678
1/2
✓ Branch 0 taken 343364 times.
✗ Branch 1 not taken.
343364 lex->get_sp_current_parsing_ctx()->pop_label();
5679 }
5680 ;
5681
5682 sp_block_content:
5683 BEGIN_SYM
5684 { /* QQ This is just a dummy for grouping declarations and statements
5685 together. No [[NOT] ATOMIC] yet, and we need to figure out how
5686 make it coexist with the existing BEGIN COMMIT/ROLLBACK. */
5687 344801 THD *thd= YYTHD;
5688 344801 LEX *lex= thd->lex;
5689 344801 sp_pcontext *parent_pctx= lex->get_sp_current_parsing_ctx();
5690
5691 sp_pcontext *child_pctx=
5692
1/2
✓ Branch 0 taken 344800 times.
✗ Branch 1 not taken.
344801 parent_pctx->push_context(thd, sp_pcontext::REGULAR_SCOPE);
5693
5694 344800 lex->set_sp_current_parsing_ctx(child_pctx);
5695 }
5696 sp_decls
5697 sp_proc_stmts
5698 END
5699 {
5700 343479 THD *thd= YYTHD;
5701 343479 LEX *lex= Lex;
5702 343479 sp_head *sp= lex->sphead;
5703 343479 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5704
5705 // We always have a label.
5706
3/6
✓ Branch 0 taken 343479 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 343478 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 343478 times.
✗ Branch 5 not taken.
343479 sp->m_parser_data.do_backpatch(pctx->last_label(),
5707 sp->instructions());
5708
5709
2/2
✓ Branch 0 taken 32002 times.
✓ Branch 1 taken 311476 times.
343478 if ($3.hndlrs)
5710 {
5711
2/4
✓ Branch 0 taken 32002 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32002 times.
✗ Branch 3 not taken.
32002 sp_instr *i= NEW_PTN sp_instr_hpop(sp->instructions(), pctx);
5712
5713
4/8
✓ Branch 0 taken 32002 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32002 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 32002 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 32002 times.
32002 if (!i || sp->add_instr(thd, i))
5714 MYSQL_YYABORT;
5715 }
5716
5717
2/2
✓ Branch 0 taken 3950 times.
✓ Branch 1 taken 339528 times.
343478 if ($3.curs)
5718 {
5719
1/2
✓ Branch 0 taken 3950 times.
✗ Branch 1 not taken.
3950 sp_instr *i= NEW_PTN sp_instr_cpop(sp->instructions(), pctx,
5720
1/2
✓ Branch 0 taken 3950 times.
✗ Branch 1 not taken.
3950 $3.curs);
5721
5722
4/8
✓ Branch 0 taken 3950 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3950 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3950 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 3950 times.
3950 if (!i || sp->add_instr(thd, i))
5723 MYSQL_YYABORT;
5724 }
5725
5726
1/2
✓ Branch 0 taken 343478 times.
✗ Branch 1 not taken.
343478 lex->set_sp_current_parsing_ctx(pctx->pop_context());
5727 }
5728 ;
5729
5730 sp_unlabeled_control:
5731 LOOP_SYM
5732 sp_proc_stmts1 END LOOP_SYM
5733 {
5734 4415 THD *thd= YYTHD;
5735 4415 LEX *lex= Lex;
5736 4415 sp_head *sp= lex->sphead;
5737 4415 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5738
5739
1/2
✓ Branch 0 taken 4415 times.
✗ Branch 1 not taken.
4415 sp_instr_jump *i= NEW_PTN sp_instr_jump(sp->instructions(), pctx,
5740
2/4
✓ Branch 0 taken 4415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4415 times.
✗ Branch 3 not taken.
4415 pctx->last_label()->ip);
5741
5742
4/8
✓ Branch 0 taken 4415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4415 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4415 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4415 times.
4415 if (!i || sp->add_instr(thd, i))
5743 MYSQL_YYABORT;
5744 }
5745 | WHILE_SYM /*$1*/
5746 { /*$2*/
5747 4895 THD *thd= YYTHD;
5748 4895 LEX *lex= thd->lex;
5749 4895 sp_head *sp= lex->sphead;
5750
5751
1/2
✓ Branch 0 taken 4896 times.
✗ Branch 1 not taken.
4895 sp->reset_lex(thd);
5752 }
5753 expr /*$3*/
5754 { /*$4*/
5755
7/14
✓ Branch 0 taken 4895 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4895 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4895 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4895 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 4895 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 4895 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 4895 times.
4894 ITEMIZE($3, &$3);
5756
5757 4895 THD *thd= YYTHD;
5758 4895 LEX *lex= Lex;
5759 4895 sp_head *sp= lex->sphead;
5760 4895 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5761
5762 /* Extract expression string. */
5763
5764 4894 LEX_CSTRING expr_query= EMPTY_CSTR;
5765 4894 const char *expr_start_ptr= @1.raw.end;
5766
5767
2/2
✓ Branch 0 taken 544 times.
✓ Branch 1 taken 4351 times.
4894 if (lex->is_metadata_used())
5768 {
5769
1/2
✓ Branch 0 taken 544 times.
✗ Branch 1 not taken.
544 expr_query= make_string(thd, expr_start_ptr, @3.raw.end);
5770
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 544 times.
544 if (!expr_query.str)
5771 MYSQL_YYABORT;
5772 }
5773
5774 /* Add jump instruction. */
5775
5776 sp_instr_jump_if_not *i=
5777 NEW_PTN
5778
3/6
✓ Branch 0 taken 4894 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4895 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4894 times.
✗ Branch 5 not taken.
4895 sp_instr_jump_if_not(sp->instructions(), lex, $3, expr_query);
5779
5780 9790 if (i == NULL ||
5781 /* Jumping forward */
5782
5/10
✓ Branch 0 taken 4895 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4895 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4895 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4895 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 4895 times.
✗ Branch 9 not taken.
9789 sp->m_parser_data.add_backpatch_entry(i, pctx->last_label()) ||
5783 4895 sp->m_parser_data.new_cont_backpatch() ||
5784
2/4
✓ Branch 0 taken 4895 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4895 times.
✗ Branch 3 not taken.
4895 sp->m_parser_data.add_cont_backpatch_entry(i) ||
5785
4/8
✓ Branch 0 taken 4894 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4895 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4895 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 4895 times.
14684 sp->add_instr(thd, i) ||
5786
2/4
✓ Branch 0 taken 4895 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4895 times.
4895 sp->restore_lex(thd))
5787 {
5788 MYSQL_YYABORT;
5789 }
5790 }
5791 DO_SYM /*$10*/
5792 sp_proc_stmts1 /*$11*/
5793 END /*$12*/
5794 WHILE_SYM /*$13*/
5795 { /*$14*/
5796 4889 THD *thd= YYTHD;
5797 4889 LEX *lex= Lex;
5798 4889 sp_head *sp= lex->sphead;
5799 4889 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5800
5801
1/2
✓ Branch 0 taken 4889 times.
✗ Branch 1 not taken.
4889 sp_instr_jump *i= NEW_PTN sp_instr_jump(sp->instructions(), pctx,
5802
2/4
✓ Branch 0 taken 4889 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4889 times.
✗ Branch 3 not taken.
4889 pctx->last_label()->ip);
5803
5804
4/8
✓ Branch 0 taken 4889 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4889 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4889 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4889 times.
4889 if (!i || sp->add_instr(thd, i))
5805 MYSQL_YYABORT;
5806
5807
2/4
✓ Branch 0 taken 4889 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4889 times.
✗ Branch 3 not taken.
4889 sp->m_parser_data.do_cont_backpatch(sp->instructions());
5808 }
5809 | REPEAT_SYM /*$1*/
5810 sp_proc_stmts1 /*$2*/
5811 UNTIL_SYM /*$3*/
5812 { /*$4*/
5813 1624 THD *thd= YYTHD;
5814 1624 LEX *lex= thd->lex;
5815 1624 sp_head *sp= lex->sphead;
5816
5817
1/2
✓ Branch 0 taken 1624 times.
✗ Branch 1 not taken.
1624 sp->reset_lex(thd);
5818 }
5819 expr /*$5*/
5820 { /*$6*/
5821
7/14
✓ Branch 0 taken 1624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1624 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1624 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1624 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1624 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1624 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1624 times.
1624 ITEMIZE($5, &$5);
5822
5823 1624 THD *thd= YYTHD;
5824 1624 LEX *lex= thd->lex;
5825 1624 sp_head *sp= lex->sphead;
5826 1624 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5827
1/2
✓ Branch 0 taken 1624 times.
✗ Branch 1 not taken.
1624 uint ip= sp->instructions();
5828
5829 /* Extract expression string. */
5830
5831 1624 LEX_CSTRING expr_query= EMPTY_CSTR;
5832 1624 const char *expr_start_ptr= @3.raw.end;
5833
5834
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 1610 times.
1624 if (lex->is_metadata_used())
5835 {
5836
1/2
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
14 expr_query= make_string(thd, expr_start_ptr, @5.raw.end);
5837
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if (!expr_query.str)
5838 MYSQL_YYABORT;
5839 }
5840
5841 /* Add jump instruction. */
5842
5843 sp_instr_jump_if_not *i=
5844 NEW_PTN sp_instr_jump_if_not(ip, lex, $5, expr_query,
5845
3/6
✓ Branch 0 taken 1624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1624 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1624 times.
✗ Branch 5 not taken.
1624 pctx->last_label()->ip);
5846
5847 3248 if (i == NULL ||
5848
4/8
✓ Branch 0 taken 1624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1624 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1624 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1624 times.
3248 sp->add_instr(thd, i) ||
5849
2/4
✓ Branch 0 taken 1624 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1624 times.
1624 sp->restore_lex(thd))
5850 {
5851 MYSQL_YYABORT;
5852 }
5853
5854 /* We can shortcut the cont_backpatch here */
5855 1624 i->set_cont_dest(ip + 1);
5856 }
5857 END /*$7*/
5858 REPEAT_SYM /*$8*/
5859 ;
5860
5861 trg_action_time:
5862 BEFORE_SYM
5863 49099 { $$= TRG_ACTION_BEFORE; }
5864 | AFTER_SYM
5865 7998 { $$= TRG_ACTION_AFTER; }
5866 ;
5867
5868 trg_event:
5869 INSERT_SYM
5870 42610 { $$= TRG_EVENT_INSERT; }
5871 | UPDATE_SYM
5872 10933 { $$= TRG_EVENT_UPDATE; }
5873 | DELETE_SYM
5874 3544 { $$= TRG_EVENT_DELETE; }
5875 ;
5876 /*
5877 This part of the parser contains common code for all TABLESPACE
5878 commands.
5879 CREATE TABLESPACE_SYM name ...
5880 ALTER TABLESPACE_SYM name ADD DATAFILE ...
5881 CREATE LOGFILE GROUP_SYM name ...
5882 ALTER LOGFILE GROUP_SYM name ADD UNDOFILE ..
5883 DROP TABLESPACE_SYM name
5884 DROP LOGFILE GROUP_SYM name
5885 */
5886
5887 opt_ts_datafile_name:
5888 143 /* empty */ { $$= { nullptr, 0}; }
5889 | ADD ts_datafile
5890 {
5891 925 $$ = $2;
5892 }
5893 ;
5894
5895 opt_logfile_group_name:
5896 1064 /* empty */ { $$= { nullptr, 0}; }
5897 | USE_SYM LOGFILE_SYM GROUP_SYM ident
5898 {
5899 4 $$= $4;
5900 }
5901 ;
5902
5903 opt_tablespace_options:
5904 277 /* empty */ { $$= NULL; }
5905 | tablespace_option_list
5906 ;
5907
5908 tablespace_option_list:
5909 tablespace_option
5910 {
5911
2/4
✓ Branch 0 taken 788 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 788 times.
✗ Branch 3 not taken.
788 $$= NEW_PTN Mem_root_array<PT_alter_tablespace_option_base*>(YYMEM_ROOT);
5912
4/8
✓ Branch 0 taken 788 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 788 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 788 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 788 times.
788 if ($$ == NULL || $$->push_back($1))
5913 MYSQL_YYABORT; /* purecov: inspected */ // OOM
5914 }
5915 | tablespace_option_list opt_comma tablespace_option
5916 {
5917 258 $$= $1;
5918
2/4
✓ Branch 0 taken 258 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 258 times.
258 if ($$->push_back($3))
5919 MYSQL_YYABORT; /* purecov: inspected */ // OOM
5920 }
5921 ;
5922
5923 tablespace_option:
5924 ts_option_initial_size
5925 | ts_option_autoextend_size
5926 | ts_option_max_size
5927 | ts_option_extent_size
5928 | ts_option_nodegroup
5929 | ts_option_engine
5930 | ts_option_wait
5931 | ts_option_comment
5932 | ts_option_file_block_size
5933 | ts_option_encryption
5934 | ts_option_encryption_key_id
5935 | ts_option_engine_attribute
5936 ;
5937
5938 opt_alter_tablespace_options:
5939 21 /* empty */ { $$= NULL; }
5940 | alter_tablespace_option_list
5941 ;
5942
5943 alter_tablespace_option_list:
5944 alter_tablespace_option
5945 {
5946
2/4
✓ Branch 0 taken 550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 550 times.
✗ Branch 3 not taken.
550 $$= NEW_PTN Mem_root_array<PT_alter_tablespace_option_base*>(YYMEM_ROOT);
5947
4/8
✓ Branch 0 taken 550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 550 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 550 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 550 times.
550 if ($$ == NULL || $$->push_back($1))
5948 MYSQL_YYABORT; /* purecov: inspected */ // OOM
5949 }
5950 | alter_tablespace_option_list opt_comma alter_tablespace_option
5951 {
5952 1 $$= $1;
5953
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if ($$->push_back($3))
5954 MYSQL_YYABORT; /* purecov: inspected */ // OOM
5955 }
5956 ;
5957
5958 alter_tablespace_option:
5959 ts_option_initial_size
5960 | ts_option_autoextend_size
5961 | ts_option_max_size
5962 | ts_option_engine
5963 | ts_option_wait
5964 | ts_option_encryption
5965 | ts_option_encryption_key_id
5966 | ts_option_engine_attribute
5967 ;
5968
5969 opt_undo_tablespace_options:
5970 1247 /* empty */ { $$= NULL; }
5971 | undo_tablespace_option_list
5972 ;
5973
5974 undo_tablespace_option_list:
5975 undo_tablespace_option
5976 {
5977
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 $$= NEW_PTN Mem_root_array<PT_alter_tablespace_option_base*>(YYMEM_ROOT);
5978
4/8
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 8 times.
8 if ($$ == NULL || $$->push_back($1))
5979 MYSQL_YYABORT; // OOM
5980 }
5981 | undo_tablespace_option_list opt_comma undo_tablespace_option
5982 {
5983 $$= $1;
5984 if ($$->push_back($3))
5985 MYSQL_YYABORT; // OOM
5986 }
5987 ;
5988
5989 undo_tablespace_option:
5990 ts_option_engine
5991 ;
5992
5993 opt_logfile_group_options:
5994 2 /* empty */ { $$= NULL; }
5995 | logfile_group_option_list
5996 ;
5997
5998 logfile_group_option_list:
5999 logfile_group_option
6000 {
6001
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 $$= NEW_PTN Mem_root_array<PT_alter_tablespace_option_base*>(YYMEM_ROOT);
6002
4/8
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
4 if ($$ == NULL || $$->push_back($1))
6003 MYSQL_YYABORT; /* purecov: inspected */ // OOM
6004 }
6005 | logfile_group_option_list opt_comma logfile_group_option
6006 {
6007 2 $$= $1;
6008
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
2 if ($$->push_back($3))
6009 MYSQL_YYABORT; /* purecov: inspected */ // OOM
6010 }
6011 ;
6012
6013 logfile_group_option:
6014 ts_option_initial_size
6015 | ts_option_undo_buffer_size
6016 | ts_option_redo_buffer_size
6017 | ts_option_nodegroup
6018 | ts_option_engine
6019 | ts_option_wait
6020 | ts_option_comment
6021 ;
6022
6023 opt_alter_logfile_group_options:
6024 /* empty */ { $$= NULL; }
6025 | alter_logfile_group_option_list
6026 ;
6027
6028 alter_logfile_group_option_list:
6029 alter_logfile_group_option
6030 {
6031
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 $$= NEW_PTN Mem_root_array<PT_alter_tablespace_option_base*>(YYMEM_ROOT);
6032
4/8
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5 times.
5 if ($$ == NULL || $$->push_back($1))
6033 MYSQL_YYABORT; /* purecov: inspected */ // OOM
6034 }
6035 | alter_logfile_group_option_list opt_comma alter_logfile_group_option
6036 {
6037 2 $$= $1;
6038
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
2 if ($$->push_back($3))
6039 MYSQL_YYABORT; /* purecov: inspected */ // OOM
6040 }
6041 ;
6042
6043 alter_logfile_group_option:
6044 ts_option_initial_size
6045 | ts_option_engine
6046 | ts_option_wait
6047 ;
6048
6049 ts_datafile:
6050 1326 DATAFILE_SYM TEXT_STRING_sys { $$= $2; }
6051 ;
6052
6053 undo_tablespace_state:
6054 100 ACTIVE_SYM { $$= ALTER_UNDO_TABLESPACE_SET_ACTIVE; }
6055 444 | INACTIVE_SYM { $$= ALTER_UNDO_TABLESPACE_SET_INACTIVE; }
6056 ;
6057
6058 lg_undofile:
6059 11 UNDOFILE_SYM TEXT_STRING_sys { $$= $2; }
6060 ;
6061
6062 ts_option_initial_size:
6063 INITIAL_SIZE_SYM opt_equal size_number
6064 {
6065
1/2
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
25 $$= NEW_PTN PT_alter_tablespace_option_initial_size($3);
6066 }
6067 ;
6068
6069 ts_option_autoextend_size:
6070 option_autoextend_size
6071 {
6072
1/2
✓ Branch 0 taken 73 times.
✗ Branch 1 not taken.
73 $$ = NEW_PTN PT_alter_tablespace_option_autoextend_size($1);
6073 }
6074 ;
6075
6076 option_autoextend_size:
6077 219 AUTOEXTEND_SIZE_SYM opt_equal size_number { $$ = $3; }
6078 ;
6079
6080 ts_option_max_size:
6081 MAX_SIZE_SYM opt_equal size_number
6082 {
6083
1/2
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
18 $$= NEW_PTN PT_alter_tablespace_option_max_size($3);
6084 }
6085 ;
6086
6087 ts_option_extent_size:
6088 EXTENT_SIZE_SYM opt_equal size_number
6089 {
6090
1/2
✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
19 $$= NEW_PTN PT_alter_tablespace_option_extent_size($3);
6091 }
6092 ;
6093
6094 ts_option_undo_buffer_size:
6095 UNDO_BUFFER_SIZE_SYM opt_equal size_number
6096 {
6097
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 $$= NEW_PTN PT_alter_tablespace_option_undo_buffer_size($3);
6098 }
6099 ;
6100
6101 ts_option_redo_buffer_size:
6102 REDO_BUFFER_SIZE_SYM opt_equal size_number
6103 {
6104 $$= NEW_PTN PT_alter_tablespace_option_redo_buffer_size($3);
6105 }
6106 ;
6107
6108 ts_option_nodegroup:
6109 NODEGROUP_SYM opt_equal real_ulong_num
6110 {
6111
2/4
✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19 times.
✗ Branch 3 not taken.
19 $$= NEW_PTN PT_alter_tablespace_option_nodegroup($3);
6112 }
6113 ;
6114
6115 ts_option_comment:
6116 COMMENT_SYM opt_equal TEXT_STRING_sys
6117 {
6118
2/4
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
21 $$= NEW_PTN PT_alter_tablespace_option_comment($3);
6119 }
6120 ;
6121
6122 ts_option_engine:
6123 opt_storage ENGINE_SYM opt_equal ident_or_text
6124 {
6125
2/4
✓ Branch 0 taken 326 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 326 times.
✗ Branch 3 not taken.
326 $$= NEW_PTN PT_alter_tablespace_option_engine(to_lex_cstring($4));
6126 }
6127 ;
6128
6129 ts_option_file_block_size:
6130 FILE_BLOCK_SIZE_SYM opt_equal size_number
6131 {
6132
2/4
✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29 times.
✗ Branch 3 not taken.
29 $$= NEW_PTN PT_alter_tablespace_option_file_block_size($3);
6133 }
6134 ;
6135
6136 ts_option_wait:
6137 WAIT_SYM
6138 {
6139
1/2
✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
20 $$= NEW_PTN PT_alter_tablespace_option_wait_until_completed(true);
6140 }
6141 | NO_WAIT_SYM
6142 {
6143
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 $$= NEW_PTN PT_alter_tablespace_option_wait_until_completed(false);
6144 }
6145 ;
6146
6147 ts_option_encryption:
6148 ENCRYPTION_SYM opt_equal TEXT_STRING_sys
6149 {
6150
1/2
✓ Branch 0 taken 1066 times.
✗ Branch 1 not taken.
1066 $$= NEW_PTN PT_alter_tablespace_option_encryption($3);
6151 }
6152 ;
6153
6154 ts_option_encryption_key_id:
6155 ENCRYPTION_KEY_ID_SYM opt_equal real_ulong_num
6156 {
6157
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
4 if ($3 >= UINT_MAX32)
6158 {
6159
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_ENCRYPTION_KEY_ID_VALUE_OUT_OF_RANGE, MYF(0), $3,
6160 UINT_MAX32 - 1);
6161 2 MYSQL_YYABORT;
6162 }
6163
6164
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 $$= NEW_PTN PT_alter_tablespace_option_encryption_key_id($3);
6165 }
6166 ;
6167
6168 ts_option_engine_attribute:
6169 ENGINE_ATTRIBUTE_SYM opt_equal json_attribute
6170 {
6171
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 $$ = make_tablespace_engine_attribute(YYMEM_ROOT, $3);
6172 }
6173 ;
6174
6175 size_number:
6176 27 real_ulonglong_num { $$= $1;}
6177 | IDENT_sys
6178 {
6179 ulonglong number;
6180 284 uint text_shift_number= 0;
6181 longlong prefix_number;
6182 284 const char *start_ptr= $1.str;
6183 284 size_t str_len= $1.length;
6184 284 const char *end_ptr= start_ptr + str_len;
6185 int error;
6186
1/2
✓ Branch 0 taken 284 times.
✗ Branch 1 not taken.
284 prefix_number= my_strtoll10(start_ptr, &end_ptr, &error);
6187
1/2
✓ Branch 0 taken 284 times.
✗ Branch 1 not taken.
284 if ((start_ptr + str_len - 1) == end_ptr)
6188 {
6189
3/4
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 247 times.
✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
284 switch (end_ptr[0])
6190 {
6191 7 case 'g':
6192 case 'G':
6193 7 text_shift_number+=10;
6194 [[fallthrough]];
6195 254 case 'm':
6196 case 'M':
6197 254 text_shift_number+=10;
6198 [[fallthrough]];
6199 284 case 'k':
6200 case 'K':
6201 284 text_shift_number+=10;
6202 284 break;
6203 default:
6204 {
6205 my_error(ER_WRONG_SIZE_NUMBER, MYF(0));
6206 MYSQL_YYABORT;
6207 }
6208 }
6209
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 284 times.
284 if (prefix_number >> 31)
6210 {
6211 my_error(ER_SIZE_OVERFLOW_ERROR, MYF(0));
6212 MYSQL_YYABORT;
6213 }
6214 284 number= prefix_number << text_shift_number;
6215 }
6216 else
6217 {
6218 my_error(ER_WRONG_SIZE_NUMBER, MYF(0));
6219 MYSQL_YYABORT;
6220 }
6221 284 $$= number;
6222 }
6223 ;
6224
6225 /*
6226 End tablespace part
6227 */
6228
6229 /*
6230 To avoid grammar conflicts, we introduce the next few rules in very details:
6231 we workaround empty rules for optional AS and DUPLICATE clauses by expanding
6232 them in place of the caller rule:
6233
6234 opt_create_table_options_etc ::=
6235 create_table_options opt_create_partitioning_etc
6236 | opt_create_partitioning_etc
6237
6238 opt_create_partitioning_etc ::=
6239 partitioin [opt_duplicate_as_qe] | [opt_duplicate_as_qe]
6240
6241 opt_duplicate_as_qe ::=
6242 duplicate as_create_query_expression
6243 | as_create_query_expression
6244
6245 as_create_query_expression ::=
6246 AS query_expression_or_parens
6247 | query_expression_or_parens
6248
6249 */
6250
6251 opt_create_table_options_etc:
6252 create_table_options
6253 opt_create_partitioning_etc
6254 {
6255 492314 $$= $2;
6256 492314 $$.opt_create_table_options= $1;
6257 }
6258 | opt_create_partitioning_etc
6259 ;
6260
6261 opt_create_partitioning_etc:
6262 partition_clause opt_duplicate_as_qe
6263 {
6264 4024 $$= $2;
6265 4024 $$.opt_partitioning= $1;
6266 }
6267 | opt_duplicate_as_qe
6268 ;
6269
6270 opt_duplicate_as_qe:
6271 /* empty */
6272 {
6273 606869 $$.opt_create_table_options= NULL;
6274 606869 $$.opt_partitioning= NULL;
6275 606869 $$.on_duplicate= On_duplicate::ERROR;
6276 606869 $$.opt_query_expression= NULL;
6277 }
6278 | duplicate
6279 as_create_query_expression
6280 {
6281 14 $$.opt_create_table_options= NULL;
6282 14 $$.opt_partitioning= NULL;
6283 14 $$.on_duplicate= $1;
6284 14 $$.opt_query_expression= $2;
6285 }
6286 | as_create_query_expression
6287 {
6288 10936 $$.opt_create_table_options= NULL;
6289 10936 $$.opt_partitioning= NULL;
6290 10936 $$.on_duplicate= On_duplicate::ERROR;
6291 10936 $$.opt_query_expression= $1;
6292 }
6293 ;
6294
6295 as_create_query_expression:
6296 6255 AS query_expression_or_parens { $$ = $2; }
6297 4695 | query_expression_or_parens { $$ = $1; }
6298 ;
6299
6300 /*
6301 This part of the parser is about handling of the partition information.
6302
6303 It's first version was written by Mikael Ronström with lots of answers to
6304 questions provided by Antony Curtis.
6305
6306 The partition grammar can be called from two places.
6307 1) CREATE TABLE ... PARTITION ..
6308 2) ALTER TABLE table_name PARTITION ...
6309 */
6310 partition_clause:
6311 PARTITION_SYM BY part_type_def opt_num_parts opt_sub_part
6312 opt_part_defs
6313 {
6314
2/4
✓ Branch 0 taken 31242 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 31242 times.
✗ Branch 3 not taken.
31242 $$= NEW_PTN PT_partition($3, $4, $5, @6, $6);
6315 }
6316 ;
6317
6318 part_type_def:
6319 opt_linear KEY_SYM opt_key_algo '(' opt_name_list ')'
6320 {
6321
2/4
✓ Branch 0 taken 4417 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4417 times.
✗ Branch 3 not taken.
4417 $$= NEW_PTN PT_part_type_def_key($1, $3, $5);
6322 }
6323 | opt_linear HASH_SYM '(' bit_expr ')'
6324 {
6325
2/4
✓ Branch 0 taken 7486 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7486 times.
✗ Branch 3 not taken.
7486 $$= NEW_PTN PT_part_type_def_hash($1, @4, $4);
6326 }
6327 | RANGE_SYM '(' bit_expr ')'
6328 {
6329
2/4
✓ Branch 0 taken 12927 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12927 times.
✗ Branch 3 not taken.
12927 $$= NEW_PTN PT_part_type_def_range_expr(@3, $3);
6330 }
6331 | RANGE_SYM COLUMNS '(' name_list ')'
6332 {
6333
2/4
✓ Branch 0 taken 341 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 341 times.
✗ Branch 3 not taken.
341 $$= NEW_PTN PT_part_type_def_range_columns($4);
6334 }
6335 | LIST_SYM '(' bit_expr ')'
6336 {
6337
2/4
✓ Branch 0 taken 6038 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6038 times.
✗ Branch 3 not taken.
6038 $$= NEW_PTN PT_part_type_def_list_expr(@3, $3);
6338 }
6339 | LIST_SYM COLUMNS '(' name_list ')'
6340 {
6341
2/4
✓ Branch 0 taken 104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 104 times.
✗ Branch 3 not taken.
104 $$= NEW_PTN PT_part_type_def_list_columns($4);
6342 }
6343 ;
6344
6345 opt_linear:
6346 21362 /* empty */ { $$= false; }
6347 334 | LINEAR_SYM { $$= true; }
6348 ;
6349
6350 opt_key_algo:
6351 /* empty */
6352 953 { $$= enum_key_algorithm::KEY_ALGORITHM_NONE; }
6353 | ALGORITHM_SYM EQ real_ulong_num
6354 {
6355
3/3
✓ Branch 0 taken 42 times.
✓ Branch 1 taken 7246 times.
✓ Branch 2 taken 1 times.
7289 switch ($3) {
6356 42 case 1:
6357 42 $$= enum_key_algorithm::KEY_ALGORITHM_51;
6358 42 break;
6359 7246 case 2:
6360 7246 $$= enum_key_algorithm::KEY_ALGORITHM_55;
6361 7246 break;
6362 1 default:
6363
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error();
6364 1 MYSQL_YYABORT;
6365 }
6366 }
6367 ;
6368
6369 opt_num_parts:
6370 /* empty */
6371 21778 { $$= 0; }
6372 | PARTITIONS_SYM real_ulong_num
6373 {
6374
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 9501 times.
9502 if ($2 == 0)
6375 {
6376
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_NO_PARTS_ERROR, MYF(0), "partitions");
6377 1 MYSQL_YYABORT;
6378 }
6379 9501 $$= $2;
6380 }
6381 ;
6382
6383 opt_sub_part:
6384 21488 /* empty */ { $$= NULL; }
6385 | SUBPARTITION_SYM BY opt_linear HASH_SYM '(' bit_expr ')'
6386 opt_num_subparts
6387 {
6388
2/4
✓ Branch 0 taken 5936 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5936 times.
✗ Branch 3 not taken.
5936 $$= NEW_PTN PT_sub_partition_by_hash($3, @6, $6, $8);
6389 }
6390 | SUBPARTITION_SYM BY opt_linear KEY_SYM opt_key_algo
6391 '(' name_list ')' opt_num_subparts
6392 {
6393
2/4
✓ Branch 0 taken 3822 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3822 times.
✗ Branch 3 not taken.
3822 $$= NEW_PTN PT_sub_partition_by_key($3, $5, $7, $9);
6394 }
6395 ;
6396
6397
6398 opt_name_list:
6399 221 /* empty */ { $$= NULL; }
6400 | name_list
6401 ;
6402
6403
6404 name_list:
6405 ident
6406 {
6407
1/2
✓ Branch 0 taken 8465 times.
✗ Branch 1 not taken.
8465 $$= NEW_PTN List<char>;
6408
4/8
✓ Branch 0 taken 8465 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8465 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8465 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 8465 times.
8465 if ($$ == NULL || $$->push_back($1.str))
6409 MYSQL_YYABORT;
6410 }
6411 | name_list ',' ident
6412 {
6413 1070 $$= $1;
6414
2/4
✓ Branch 0 taken 1070 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1070 times.
1070 if ($$->push_back($3.str))
6415 MYSQL_YYABORT;
6416 }
6417 ;
6418
6419 opt_num_subparts:
6420 /* empty */
6421 4830 { $$= 0; }
6422 | SUBPARTITIONS_SYM real_ulong_num
6423 {
6424
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 4928 times.
4929 if ($2 == 0)
6425 {
6426
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_NO_PARTS_ERROR, MYF(0), "subpartitions");
6427 1 MYSQL_YYABORT;
6428 }
6429 4928 $$= $2;
6430 }
6431 ;
6432
6433 opt_part_defs:
6434 10361 /* empty */ { $$= NULL; }
6435 20881 | '(' part_def_list ')' { $$= $2; }
6436 ;
6437
6438 part_def_list:
6439 part_definition
6440 {
6441
2/4
✓ Branch 0 taken 21323 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21323 times.
✗ Branch 3 not taken.
21323 $$= NEW_PTN Mem_root_array<PT_part_definition*>(YYMEM_ROOT);
6442
4/8
✓ Branch 0 taken 21323 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21323 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 21323 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 21323 times.
21323 if ($$ == NULL || $$->push_back($1))
6443 MYSQL_YYABORT; // OOM
6444 }
6445 | part_def_list ',' part_definition
6446 {
6447 60295 $$= $1;
6448
2/4
✓ Branch 0 taken 60295 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 60295 times.
60295 if ($$->push_back($3))
6449 MYSQL_YYABORT; // OOM
6450 }
6451 ;
6452
6453 part_definition:
6454 PARTITION_SYM ident opt_part_values opt_part_options opt_sub_partition
6455 {
6456 81618 $$= NEW_PTN PT_part_definition(@0, $2, $3.type, $3.values, @3,
6457
2/4
✓ Branch 0 taken 81618 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 81618 times.
✗ Branch 3 not taken.
81618 $4, $5, @5);
6458 }
6459 ;
6460
6461 opt_part_values:
6462 /* empty */
6463 {
6464 4964 $$.type= partition_type::HASH;
6465 }
6466 | VALUES LESS_SYM THAN_SYM part_func_max
6467 {
6468 47919 $$.type= partition_type::RANGE;
6469 47919 $$.values= $4;
6470 }
6471 | VALUES IN_SYM part_values_in
6472 {
6473 28735 $$.type= partition_type::LIST;
6474 28735 $$.values= $3;
6475 }
6476 ;
6477
6478 part_func_max:
6479 4356 MAX_VALUE_SYM { $$= NULL; }
6480 | part_value_item_list_paren
6481 ;
6482
6483 part_values_in:
6484 part_value_item_list_paren
6485 {
6486
2/4
✓ Branch 0 taken 28605 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28605 times.
✗ Branch 3 not taken.
28605 $$= NEW_PTN PT_part_values_in_item(@1, $1);
6487 }
6488 | '(' part_value_list ')'
6489 {
6490
2/4
✓ Branch 0 taken 130 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 130 times.
✗ Branch 3 not taken.
130 $$= NEW_PTN PT_part_values_in_list(@3, $2);
6491 }
6492 ;
6493
6494 part_value_list:
6495 part_value_item_list_paren
6496 {
6497 131 $$= NEW_PTN
6498
2/4
✓ Branch 0 taken 131 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 131 times.
✗ Branch 3 not taken.
131 Mem_root_array<PT_part_value_item_list_paren *>(YYMEM_ROOT);
6499
4/8
✓ Branch 0 taken 131 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 131 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 131 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 131 times.
131 if ($$ == NULL || $$->push_back($1))
6500 MYSQL_YYABORT; // OOM
6501 }
6502 | part_value_list ',' part_value_item_list_paren
6503 {
6504 896 $$= $1;
6505
2/4
✓ Branch 0 taken 896 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 896 times.
896 if ($$->push_back($3))
6506 MYSQL_YYABORT; // OOM
6507 }
6508 ;
6509
6510 part_value_item_list_paren:
6511 '('
6512 {
6513 /*
6514 This empty action is required because it resolves 2 reduce/reduce
6515 conflicts with an anonymous row expression:
6516
6517 simple_expr:
6518 ...
6519 | '(' expr ',' expr_list ')'
6520 */
6521 }
6522 part_value_item_list ')'
6523 {
6524
2/4
✓ Branch 0 taken 73195 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73195 times.
✗ Branch 3 not taken.
73195 $$= NEW_PTN PT_part_value_item_list_paren($3, @4);
6525 }
6526 ;
6527
6528 part_value_item_list:
6529 part_value_item
6530 {
6531
2/4
✓ Branch 0 taken 73195 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73195 times.
✗ Branch 3 not taken.
73195 $$= NEW_PTN Mem_root_array<PT_part_value_item *>(YYMEM_ROOT);
6532
4/8
✓ Branch 0 taken 73195 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73195 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 73195 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 73195 times.
73195 if ($$ == NULL || $$->push_back($1))
6533 MYSQL_YYABORT; // OOM
6534 }
6535 | part_value_item_list ',' part_value_item
6536 {
6537 43466 $$= $1;
6538
2/4
✓ Branch 0 taken 43466 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 43466 times.
43466 if ($$->push_back($3))
6539 MYSQL_YYABORT; // OOM
6540 }
6541 ;
6542
6543 part_value_item:
6544
2/4
✓ Branch 0 taken 339 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 339 times.
✗ Branch 3 not taken.
339 MAX_VALUE_SYM { $$= NEW_PTN PT_part_value_item_max(@1); }
6545
2/4
✓ Branch 0 taken 116322 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116322 times.
✗ Branch 3 not taken.
116322 | bit_expr { $$= NEW_PTN PT_part_value_item_expr(@1, $1); }
6546 ;
6547
6548
6549 opt_sub_partition:
6550 64713 /* empty */ { $$= NULL; }
6551 16905 | '(' sub_part_list ')' { $$= $2; }
6552 ;
6553
6554 sub_part_list:
6555 sub_part_definition
6556 {
6557
2/4
✓ Branch 0 taken 16905 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16905 times.
✗ Branch 3 not taken.
16905 $$= NEW_PTN Mem_root_array<PT_subpartition *>(YYMEM_ROOT);
6558
4/8
✓ Branch 0 taken 16905 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16905 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 16905 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 16905 times.
16905 if ($$ == NULL || $$->push_back($1))
6559 MYSQL_YYABORT; // OOM
6560 }
6561 | sub_part_list ',' sub_part_definition
6562 {
6563 18768 $$= $1;
6564
2/4
✓ Branch 0 taken 18768 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 18768 times.
18768 if ($$->push_back($3))
6565 MYSQL_YYABORT; // OOM
6566 }
6567 ;
6568
6569 sub_part_definition:
6570 SUBPARTITION_SYM ident_or_text opt_part_options
6571 {
6572
2/4
✓ Branch 0 taken 35673 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35673 times.
✗ Branch 3 not taken.
35673 $$= NEW_PTN PT_subpartition(@1, $2.str, $3);
6573 }
6574 ;
6575
6576 opt_part_options:
6577 26962 /* empty */ { $$= NULL; }
6578 | part_option_list
6579 ;
6580
6581 part_option_list:
6582 part_option_list part_option
6583 {
6584 3275 $$= $1;
6585
2/4
✓ Branch 0 taken 3275 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3275 times.
3275 if ($$->push_back($2))
6586 MYSQL_YYABORT; // OOM
6587 }
6588 | part_option
6589 {
6590
2/4
✓ Branch 0 taken 90329 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 90329 times.
✗ Branch 3 not taken.
90329 $$= NEW_PTN Mem_root_array<PT_partition_option *>(YYMEM_ROOT);
6591
4/8
✓ Branch 0 taken 90329 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 90329 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 90329 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 90329 times.
90329 if ($$ == NULL || $$->push_back($1))
6592 MYSQL_YYABORT; // OOM
6593 }
6594 ;
6595
6596 part_option:
6597 TABLESPACE_SYM opt_equal ident
6598
2/4
✓ Branch 0 taken 1567 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1567 times.
✗ Branch 3 not taken.
1567 { $$= NEW_PTN PT_partition_tablespace($3.str); }
6599 | opt_storage ENGINE_SYM opt_equal ident_or_text
6600
2/4
✓ Branch 0 taken 89541 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 89541 times.
✗ Branch 3 not taken.
89541 { $$= NEW_PTN PT_partition_engine(to_lex_cstring($4)); }
6601 | NODEGROUP_SYM opt_equal real_ulong_num
6602
2/4
✓ Branch 0 taken 97 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 97 times.
✗ Branch 3 not taken.
97 { $$= NEW_PTN PT_partition_nodegroup($3); }
6603 | MAX_ROWS opt_equal real_ulonglong_num
6604
2/4
✓ Branch 0 taken 335 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 335 times.
✗ Branch 3 not taken.
335 { $$= NEW_PTN PT_partition_max_rows($3); }
6605 | MIN_ROWS opt_equal real_ulonglong_num
6606
2/4
✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 332 times.
✗ Branch 3 not taken.
332 { $$= NEW_PTN PT_partition_min_rows($3); }
6607 | DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
6608
2/4
✓ Branch 0 taken 1362 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1362 times.
✗ Branch 3 not taken.
1362 { $$= NEW_PTN PT_partition_data_directory($4.str); }
6609 | INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
6610
2/4
✓ Branch 0 taken 169 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 169 times.
✗ Branch 3 not taken.
169 { $$= NEW_PTN PT_partition_index_directory($4.str); }
6611 | COMMENT_SYM opt_equal TEXT_STRING_sys
6612
2/4
✓ Branch 0 taken 201 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 201 times.
✗ Branch 3 not taken.
201 { $$= NEW_PTN PT_partition_comment($3.str); }
6613 ;
6614
6615 /*
6616 End of partition parser part
6617 */
6618
6619 alter_database_options:
6620 alter_database_option
6621 | alter_database_options alter_database_option
6622 ;
6623
6624 alter_database_option:
6625 create_database_option
6626 | READ_SYM ONLY_SYM opt_equal ternary_option
6627 {
6628 /*
6629 If the statement has set READ ONLY already, and we repeat the
6630 READ ONLY option in the statement, the option must be set to
6631 the same value as before, otherwise, report an error.
6632 */
6633
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 139 times.
148 if ((Lex->create_info->used_fields &
6634 9 HA_CREATE_USED_READ_ONLY) &&
6635 9 (Lex->create_info->schema_read_only !=
6636
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 5 times.
9 ($4 == Ternary_option::ON))) {
6637
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 my_error(ER_CONFLICTING_DECLARATIONS, MYF(0), "READ ONLY", "=0",
6638 "READ ONLY", "=1");
6639 4 MYSQL_YYABORT;
6640 }
6641 144 Lex->create_info->schema_read_only = ($4 == Ternary_option::ON);
6642 144 Lex->create_info->used_fields |= HA_CREATE_USED_READ_ONLY;
6643 }
6644 ;
6645
6646 opt_create_database_options:
6647 /* empty */ {}
6648 | create_database_options {}
6649 ;
6650
6651 create_database_options:
6652 create_database_option {}
6653 | create_database_options create_database_option {}
6654 ;
6655
6656 create_database_option:
6657 default_collation
6658 {
6659
3/4
✓ Branch 0 taken 10209 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 10208 times.
10209 if (set_default_collation(Lex->create_info, $1))
6660 1 MYSQL_YYABORT;
6661 }
6662 | default_charset
6663 {
6664
3/4
✓ Branch 0 taken 1917 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1916 times.
1917 if (set_default_charset(Lex->create_info, $1))
6665 1 MYSQL_YYABORT;
6666 }
6667 | default_encryption
6668 {
6669 // Validate if we have either 'y|Y' or 'n|N'
6670
5/6
✓ Branch 0 taken 972 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 583 times.
✓ Branch 3 taken 389 times.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 968 times.
1555 if (my_strcasecmp(system_charset_info, $1.str, "Y") != 0 &&
6671
3/4
✓ Branch 0 taken 583 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 579 times.
583 my_strcasecmp(system_charset_info, $1.str, "N") != 0) {
6672
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 my_error(ER_WRONG_VALUE, MYF(0), "argument (should be Y or N)", $1.str);
6673 4 MYSQL_YYABORT;
6674 }
6675
6676 968 Lex->create_info->encrypt_type= $1;
6677 968 Lex->create_info->used_fields |= HA_CREATE_USED_DEFAULT_ENCRYPTION;
6678 }
6679 ;
6680
6681 opt_if_not_exists:
6682 886399 /* empty */ { $$= false; }
6683 46467 | IF not EXISTS { $$= true; }
6684 ;
6685
6686 create_table_options_space_separated:
6687 create_table_option
6688 {
6689
2/4
✓ Branch 0 taken 24107 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24107 times.
✗ Branch 3 not taken.
24107 $$= NEW_PTN Mem_root_array<PT_ddl_table_option *>(YYMEM_ROOT);
6690
4/8
✓ Branch 0 taken 24107 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24107 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 24107 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 24107 times.
24107 if ($$ == NULL || $$->push_back($1))
6691 MYSQL_YYABORT; // OOM
6692 }
6693 | create_table_options_space_separated create_table_option
6694 {
6695 3995 $$= $1;
6696
2/4
✓ Branch 0 taken 3995 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3995 times.
3995 if ($$->push_back($2))
6697 MYSQL_YYABORT; // OOM
6698 }
6699 ;
6700
6701 create_table_options:
6702 create_table_option
6703 {
6704
2/4
✓ Branch 0 taken 492322 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 492322 times.
✗ Branch 3 not taken.
492322 $$= NEW_PTN Mem_root_array<PT_create_table_option *>(YYMEM_ROOT);
6705
4/8
✓ Branch 0 taken 492322 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 492323 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 492323 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 492323 times.
492322 if ($$ == NULL || $$->push_back($1))
6706 MYSQL_YYABORT; // OOM
6707 }
6708 | create_table_options opt_comma create_table_option
6709 {
6710 1752169 $$= $1;
6711
2/4
✓ Branch 0 taken 1752169 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1752169 times.
1752169 if ($$->push_back($3))
6712 MYSQL_YYABORT; // OOM
6713 }
6714 ;
6715
6716 opt_comma:
6717 /* empty */
6718 | ','
6719 ;
6720
6721 create_table_option:
6722 ENGINE_SYM opt_equal ident_or_text
6723 {
6724
2/4
✓ Branch 0 taken 490510 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 490510 times.
✗ Branch 3 not taken.
490510 $$= NEW_PTN PT_create_table_engine_option(to_lex_cstring($3));
6725 }
6726 | SECONDARY_ENGINE_SYM opt_equal NULL_SYM
6727 {
6728
1/2
✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
60 $$= NEW_PTN PT_create_table_secondary_engine_option();
6729 }
6730 | SECONDARY_ENGINE_SYM opt_equal ident_or_text
6731 {
6732
2/4
✓ Branch 0 taken 112 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
✗ Branch 3 not taken.
112 $$= NEW_PTN PT_create_table_secondary_engine_option(to_lex_cstring($3));
6733 }
6734 | MAX_ROWS opt_equal ulonglong_num
6735 {
6736
2/4
✓ Branch 0 taken 51 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 51 times.
✗ Branch 3 not taken.
51 $$= NEW_PTN PT_create_max_rows_option($3);
6737 }
6738 | MIN_ROWS opt_equal ulonglong_num
6739 {
6740
2/4
✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
24 $$= NEW_PTN PT_create_min_rows_option($3);
6741 }
6742 | AVG_ROW_LENGTH opt_equal ulonglong_num
6743 {
6744 // The frm-format only allocated 4 bytes for avg_row_length, and
6745 // there is code which assumes it can be represented as an uint,
6746 // so we constrain it here.
6747
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 19 times.
21 if ($3 > std::numeric_limits<std::uint32_t>::max()) {
6748
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 YYTHD->syntax_error_at(@3,
6749 "The valid range for avg_row_length is [0,4294967295]. Error"
6750 );
6751 2 MYSQL_YYABORT;
6752 }
6753
2/4
✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19 times.
✗ Branch 3 not taken.
19 $$= NEW_PTN PT_create_avg_row_length_option($3);
6754 }
6755 | PASSWORD opt_equal TEXT_STRING_sys
6756 {
6757 $$= NEW_PTN PT_create_password_option($3.str);
6758 }
6759 | COMMENT_SYM opt_equal TEXT_STRING_sys
6760 {
6761
2/4
✓ Branch 0 taken 13689 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13689 times.
✗ Branch 3 not taken.
13689 $$= NEW_PTN PT_create_commen_option($3);
6762 }
6763 | COMPRESSION_SYM opt_equal TEXT_STRING_sys
6764 {
6765
2/4
✓ Branch 0 taken 167 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 167 times.
✗ Branch 3 not taken.
167 $$= NEW_PTN PT_create_compress_option($3);
6766 }
6767 | ENCRYPTION_SYM opt_equal TEXT_STRING_sys
6768 {
6769
2/4
✓ Branch 0 taken 20791 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20791 times.
✗ Branch 3 not taken.
20791 $$= NEW_PTN PT_create_encryption_option($3);
6770 }
6771 | ENCRYPTION_KEY_ID_SYM opt_equal real_ulong_num
6772 {
6773
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
4 if ($3 >= UINT_MAX32)
6774 {
6775
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_ENCRYPTION_KEY_ID_VALUE_OUT_OF_RANGE, MYF(0), $3,
6776 UINT_MAX32 - 1);
6777 2 MYSQL_YYABORT;
6778 }
6779
6780
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 $$= NEW_PTN PT_create_encryption_key_id_option($3);
6781 }
6782 | AUTO_INC opt_equal ulonglong_num
6783 {
6784
2/4
✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 695 times.
✗ Branch 3 not taken.
695 $$= NEW_PTN PT_create_auto_increment_option($3);
6785 }
6786 | PACK_KEYS_SYM opt_equal ternary_option
6787 {
6788
2/4
✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 81 times.
✗ Branch 3 not taken.
81 $$= NEW_PTN PT_create_pack_keys_option($3);
6789 }
6790 | STATS_AUTO_RECALC_SYM opt_equal ternary_option
6791 {
6792
2/4
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
18 $$= NEW_PTN PT_create_stats_auto_recalc_option($3);
6793 }
6794 | STATS_PERSISTENT_SYM opt_equal ternary_option
6795 {
6796
2/4
✓ Branch 0 taken 347935 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 347935 times.
✗ Branch 3 not taken.
347935 $$= NEW_PTN PT_create_stats_persistent_option($3);
6797 }
6798 | STATS_SAMPLE_PAGES_SYM opt_equal ulong_num
6799 {
6800 /* From user point of view STATS_SAMPLE_PAGES can be specified as
6801 STATS_SAMPLE_PAGES=N (where 0<N<=65535, it does not make sense to
6802 scan 0 pages) or STATS_SAMPLE_PAGES=default. Internally we record
6803 =default as 0. See create_frm() in sql/table.cc, we use only two
6804 bytes for stats_sample_pages and this is why we do not allow
6805 larger values. 65535 pages, 16kb each means to sample 1GB, which
6806 is impractical. If at some point this needs to be extended, then
6807 we can store the higher bits from stats_sample_pages in .frm too. */
6808
4/4
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 5 times.
9 if ($3 == 0 || $3 > 0xffff)
6809 {
6810
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 YYTHD->syntax_error_at(@3,
6811 "The valid range for stats_sample_pages is [1, 65535]. Error");
6812 4 MYSQL_YYABORT;
6813 }
6814
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 $$= NEW_PTN PT_create_stats_stable_pages($3);
6815 }
6816 | STATS_SAMPLE_PAGES_SYM opt_equal DEFAULT_SYM
6817 {
6818
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 $$= NEW_PTN PT_create_stats_stable_pages;
6819 }
6820 | CHECKSUM_SYM opt_equal ulong_num
6821 {
6822
2/4
✓ Branch 0 taken 41 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 41 times.
✗ Branch 3 not taken.
41 $$= NEW_PTN PT_create_checksum_option($3);
6823 }
6824 | TABLE_CHECKSUM_SYM opt_equal ulong_num
6825 {
6826 $$= NEW_PTN PT_create_checksum_option($3);
6827 }
6828 | DELAY_KEY_WRITE_SYM opt_equal ulong_num
6829 {
6830
2/4
✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
24 $$= NEW_PTN PT_create_delay_key_write_option($3);
6831 }
6832 | ROW_FORMAT_SYM opt_equal row_types
6833 {
6834
2/4
✓ Branch 0 taken 351756 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 351757 times.
✗ Branch 3 not taken.
351755 $$= NEW_PTN PT_create_row_format_option($3);
6835 }
6836 | UNION_SYM opt_equal '(' opt_table_list ')'
6837 {
6838
2/4
✓ Branch 0 taken 90 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 90 times.
✗ Branch 3 not taken.
90 $$= NEW_PTN PT_create_union_option($4);
6839 }
6840 | default_charset
6841 {
6842
2/4
✓ Branch 0 taken 356859 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356860 times.
✗ Branch 3 not taken.
356859 $$= NEW_PTN PT_create_table_default_charset($1);
6843 }
6844 | default_collation
6845 {
6846
2/4
✓ Branch 0 taken 338030 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 338030 times.
✗ Branch 3 not taken.
338030 $$= NEW_PTN PT_create_table_default_collation($1);
6847 }
6848 | INSERT_METHOD opt_equal merge_insert_types
6849 {
6850
2/4
✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 60 times.
✗ Branch 3 not taken.
60 $$= NEW_PTN PT_create_insert_method_option($3);
6851 }
6852 | DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
6853 {
6854
2/4
✓ Branch 0 taken 161 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 161 times.
✗ Branch 3 not taken.
161 $$= NEW_PTN PT_create_data_directory_option($4.str);
6855 }
6856 | INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
6857 {
6858
2/4
✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
24 $$= NEW_PTN PT_create_index_directory_option($4.str);
6859 }
6860 | TABLESPACE_SYM opt_equal ident
6861 {
6862
2/4
✓ Branch 0 taken 350664 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 350664 times.
✗ Branch 3 not taken.
350664 $$= NEW_PTN PT_create_tablespace_option($3.str);
6863 }
6864 | STORAGE_SYM DISK_SYM
6865 {
6866
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 $$= NEW_PTN PT_create_storage_option(HA_SM_DISK);
6867 }
6868 | STORAGE_SYM MEMORY_SYM
6869 {
6870
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 $$= NEW_PTN PT_create_storage_option(HA_SM_MEMORY);
6871 }
6872 | CONNECTION_SYM opt_equal TEXT_STRING_sys
6873 {
6874
2/4
✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 74 times.
✗ Branch 3 not taken.
74 $$= NEW_PTN PT_create_connection_option($3);
6875 }
6876 | KEY_BLOCK_SIZE opt_equal ulonglong_num
6877 {
6878 // The frm-format only allocated 2 bytes for key_block_size,
6879 // even if it is represented as std::uint32_t in HA_CREATE_INFO and
6880 // elsewhere.
6881
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 395 times.
400 if ($3 > std::numeric_limits<std::uint16_t>::max()) {
6882
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 YYTHD->syntax_error_at(@3,
6883 "The valid range for key_block_size is [0,65535]. Error");
6884 5 MYSQL_YYABORT;
6885 }
6886
6887
1/2
✓ Branch 0 taken 395 times.
✗ Branch 1 not taken.
790 $$= NEW_PTN
6888
1/2
✓ Branch 0 taken 395 times.
✗ Branch 1 not taken.
790 PT_create_key_block_size_option(static_cast<std::uint32_t>($3));
6889 }
6890 | START_SYM TRANSACTION_SYM
6891 {
6892
2/4
✓ Branch 0 taken 73 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73 times.
✗ Branch 3 not taken.
73 $$= NEW_PTN PT_create_start_transaction_option(true);
6893 }
6894 | ENGINE_ATTRIBUTE_SYM opt_equal json_attribute
6895 {
6896
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
26 $$ = make_table_engine_attribute(YYMEM_ROOT, $3);
6897 }
6898 | SECONDARY_ENGINE_ATTRIBUTE_SYM opt_equal json_attribute
6899 {
6900
1/2
✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
27 $$ = make_table_secondary_engine_attribute(YYMEM_ROOT, $3);
6901 }
6902 | option_autoextend_size
6903 {
6904
2/4
✓ Branch 0 taken 146 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 146 times.
✗ Branch 3 not taken.
146 $$ = NEW_PTN PT_create_ts_autoextend_size_option($1);
6905 }
6906 ;
6907
6908 ternary_option:
6909 ulong_num
6910 {
6911
3/3
✓ Branch 0 taken 347974 times.
✓ Branch 1 taken 187 times.
✓ Branch 2 taken 1 times.
348162 switch($1) {
6912 347974 case 0:
6913 347974 $$= Ternary_option::OFF;
6914 347974 break;
6915 187 case 1:
6916 187 $$= Ternary_option::ON;
6917 187 break;
6918 1 default:
6919
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error();
6920 1 MYSQL_YYABORT;
6921 }
6922 }
6923 21 | DEFAULT_SYM { $$= Ternary_option::DEFAULT; }
6924 ;
6925
6926 default_charset:
6927 358776 opt_default character_set opt_equal charset_name { $$ = $4; }
6928 ;
6929
6930 default_collation:
6931 348239 opt_default COLLATE_SYM opt_equal collation_name { $$ = $4;}
6932 ;
6933
6934 default_encryption:
6935 972 opt_default ENCRYPTION_SYM opt_equal TEXT_STRING_sys { $$ = $4;}
6936 ;
6937
6938 row_types:
6939 28 DEFAULT_SYM { $$= ROW_TYPE_DEFAULT; }
6940 21 | FIXED_SYM { $$= ROW_TYPE_FIXED; }
6941 349382 | DYNAMIC_SYM { $$= ROW_TYPE_DYNAMIC; }
6942 806 | COMPRESSED_SYM { $$= ROW_TYPE_COMPRESSED; }
6943 731 | REDUNDANT_SYM { $$= ROW_TYPE_REDUNDANT; }
6944 789 | COMPACT_SYM { $$= ROW_TYPE_COMPACT; }
6945 ;
6946
6947 merge_insert_types:
6948 NO_SYM { $$= MERGE_INSERT_DISABLED; }
6949 17 | FIRST_SYM { $$= MERGE_INSERT_TO_FIRST; }
6950 43 | LAST_SYM { $$= MERGE_INSERT_TO_LAST; }
6951 ;
6952
6953 udf_type:
6954 120 STRING_SYM {$$ = (int) STRING_RESULT; }
6955 17 | REAL_SYM {$$ = (int) REAL_RESULT; }
6956 | DECIMAL_SYM {$$ = (int) DECIMAL_RESULT; }
6957 70 | INT_SYM {$$ = (int) INT_RESULT; }
6958 ;
6959
6960 table_element_list:
6961 table_element
6962 {
6963
2/4
✓ Branch 0 taken 610102 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 610101 times.
✗ Branch 3 not taken.
610102 $$= NEW_PTN Mem_root_array<PT_table_element *>(YYMEM_ROOT);
6964
4/8
✓ Branch 0 taken 610101 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 610103 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 610103 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 610103 times.
610101 if ($$ == NULL || $$->push_back($1))
6965 MYSQL_YYABORT; // OOM
6966 }
6967 | table_element_list ',' table_element
6968 {
6969 5610005 $$= $1;
6970
2/4
✓ Branch 0 taken 5610005 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5610005 times.
5610005 if ($$->push_back($3))
6971 MYSQL_YYABORT; // OOM
6972 }
6973 ;
6974
6975 table_element:
6976 4627173 column_def { $$= $1; }
6977 1592933 | table_constraint_def { $$= $1; }
6978 ;
6979
6980 column_def:
6981 ident field_def opt_references
6982 {
6983
2/4
✓ Branch 0 taken 4627173 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4627172 times.
✗ Branch 3 not taken.
4627174 $$= NEW_PTN PT_column_def($1, $2, $3);
6984 }
6985 ;
6986
6987 opt_references:
6988 4659402 /* empty */ { $$= NULL; }
6989 | references
6990 {
6991 /* Currently we ignore FK references here: */
6992 6 $$= NULL;
6993 }
6994 ;
6995
6996 table_constraint_def:
6997 key_or_index opt_index_name_and_type '(' key_list_with_expression ')'
6998 opt_index_options
6999 {
7000
1/2
✓ Branch 0 taken 396677 times.
✗ Branch 1 not taken.
793354 $$= NEW_PTN PT_inline_index_definition(KEYTYPE_MULTIPLE,
7001
1/2
✓ Branch 0 taken 396677 times.
✗ Branch 1 not taken.
1190031 $2.name, $2.type, $4, $6);
7002 }
7003 | FULLTEXT_SYM opt_key_or_index opt_ident '(' key_list_with_expression ')'
7004 opt_fulltext_index_options
7005 {
7006
1/2
✓ Branch 0 taken 1054 times.
✗ Branch 1 not taken.
2108 $$= NEW_PTN PT_inline_index_definition(KEYTYPE_FULLTEXT, $3, NULL,
7007
1/2
✓ Branch 0 taken 1054 times.
✗ Branch 1 not taken.
3162 $5, $7);
7008 }
7009 | SPATIAL_SYM opt_key_or_index opt_ident '(' key_list_with_expression ')'
7010 opt_spatial_index_options
7011 {
7012
2/4
✓ Branch 0 taken 530 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 530 times.
✗ Branch 3 not taken.
530 $$= NEW_PTN PT_inline_index_definition(KEYTYPE_SPATIAL, $3, NULL, $5, $7);
7013 }
7014 | opt_constraint_name constraint_key_type opt_index_name_and_type
7015 '(' key_list_with_expression ')' opt_index_options
7016 {
7017
2/2
✓ Branch 0 taken 363 times.
✓ Branch 1 taken 703737 times.
704100 if (($1.length != 0)
7018
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 361 times.
363 && ($2 == (KEYTYPE_CLUSTERING | KEYTYPE_MULTIPLE)))
7019 {
7020 /* Forbid "CONSTRAINT c CLUSTERING" */
7021
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SYNTAX_ERROR, MYF(0));
7022 2 MYSQL_YYABORT;
7023 }
7024 /*
7025 Constraint-implementing indexes are named by the constraint type
7026 by default.
7027 */
7028
2/2
✓ Branch 0 taken 30110 times.
✓ Branch 1 taken 673988 times.
704098 LEX_STRING name= $3.name.str != NULL ? $3.name : $1;
7029
2/4
✓ Branch 0 taken 704099 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 704098 times.
✗ Branch 3 not taken.
704098 $$= NEW_PTN PT_inline_index_definition($2, name, $3.type, $5, $7);
7030 }
7031 | opt_constraint_name FOREIGN KEY_SYM opt_ident '(' key_list ')' references
7032 {
7033
1/2
✓ Branch 0 taken 497641 times.
✗ Branch 1 not taken.
995282 $$= NEW_PTN PT_foreign_key_definition($1, $4, $6, $8.table_name,
7034 $8.reference_list,
7035 $8.fk_match_option,
7036 $8.fk_update_opt,
7037
1/2
✓ Branch 0 taken 497641 times.
✗ Branch 1 not taken.
995282 $8.fk_delete_opt);
7038 }
7039 | opt_constraint_name check_constraint opt_constraint_enforcement
7040 {
7041
2/4
✓ Branch 0 taken 789 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 789 times.
✗ Branch 3 not taken.
789 $$= NEW_PTN PT_check_constraint($1, $2, $3);
7042
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 789 times.
789 if ($$ == nullptr) MYSQL_YYABORT; // OOM
7043 }
7044 ;
7045
7046 check_constraint:
7047 1006 CHECK_SYM '(' expr ')' { $$= $3; }
7048 ;
7049
7050 opt_constraint_name:
7051 1200057 /* empty */ { $$= NULL_STR; }
7052 2727 | CONSTRAINT opt_ident { $$= $2; }
7053 ;
7054
7055 opt_not:
7056 180 /* empty */ { $$= false; }
7057 597 | NOT_SYM { $$= true; }
7058 ;
7059
7060 opt_constraint_enforcement:
7061 200 /* empty */ { $$= true; }
7062 589 | constraint_enforcement { $$= $1; }
7063 ;
7064
7065 constraint_enforcement:
7066 775 opt_not ENFORCED_SYM { $$= !($1); }
7067 ;
7068
7069 field_def:
7070 type opt_column_attribute_list
7071 {
7072
2/4
✓ Branch 0 taken 4689414 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4689415 times.
✗ Branch 3 not taken.
4689414 $$= NEW_PTN PT_field_def($1, $2);
7073 }
7074 | type opt_collate opt_generated_always
7075 AS '(' expr ')'
7076 opt_stored_attribute opt_column_attribute_list
7077 {
7078 5210 auto *opt_attrs= $9;
7079
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 5205 times.
5210 if ($2 != NULL)
7080 {
7081
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (opt_attrs == NULL)
7082 {
7083 opt_attrs= NEW_PTN
7084 Mem_root_array<PT_column_attr_base *>(YYMEM_ROOT);
7085 }
7086
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 auto *collation= NEW_PTN PT_collate_column_attr(@2, $2);
7087
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
10 if (opt_attrs == nullptr || collation == nullptr ||
7088
3/6
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
10 opt_attrs->push_back(collation))
7089 MYSQL_YYABORT; // OOM
7090 }
7091
2/4
✓ Branch 0 taken 5210 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5210 times.
✗ Branch 3 not taken.
5210 $$= NEW_PTN PT_generated_field_def($1, $6, $8, opt_attrs);
7092 }
7093 ;
7094
7095 opt_generated_always:
7096 /* empty */
7097 | GENERATED ALWAYS_SYM
7098 ;
7099
7100 opt_stored_attribute:
7101 814 /* empty */ { $$= Virtual_or_stored::VIRTUAL; }
7102 3180 | VIRTUAL_SYM { $$= Virtual_or_stored::VIRTUAL; }
7103 1216 | STORED_SYM { $$= Virtual_or_stored::STORED; }
7104 ;
7105
7106 type:
7107 int_type opt_field_length field_options
7108 {
7109
2/4
✓ Branch 0 taken 2112154 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2112156 times.
✗ Branch 3 not taken.
2112155 $$= NEW_PTN PT_numeric_type(YYTHD, $1, $2, $3);
7110 }
7111 | real_type opt_precision field_options
7112 {
7113
2/4
✓ Branch 0 taken 5481 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5481 times.
✗ Branch 3 not taken.
5481 $$= NEW_PTN PT_numeric_type(YYTHD, $1, $2.length, $2.dec, $3);
7114 }
7115 | numeric_type float_options field_options
7116 {
7117
2/4
✓ Branch 0 taken 18318 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18317 times.
✗ Branch 3 not taken.
18318 $$= NEW_PTN PT_numeric_type(YYTHD, $1, $2.length, $2.dec, $3);
7118 }
7119 | BIT_SYM %prec KEYWORD_USED_AS_KEYWORD
7120 {
7121
2/4
✓ Branch 0 taken 907 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 907 times.
✗ Branch 3 not taken.
907 $$= NEW_PTN PT_bit_type;
7122 }
7123 | BIT_SYM field_length
7124 {
7125
2/4
✓ Branch 0 taken 1149 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1149 times.
✗ Branch 3 not taken.
1149 $$= NEW_PTN PT_bit_type($2);
7126 }
7127 | BOOL_SYM
7128 {
7129
2/4
✓ Branch 0 taken 186610 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 186610 times.
✗ Branch 3 not taken.
186610 $$= NEW_PTN PT_boolean_type;
7130 }
7131 | BOOLEAN_SYM
7132 {
7133
2/4
✓ Branch 0 taken 25023 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25023 times.
✗ Branch 3 not taken.
25023 $$= NEW_PTN PT_boolean_type;
7134 }
7135 | CHAR_SYM field_length opt_charset_with_opt_binary
7136 {
7137
1/2
✓ Branch 0 taken 142282 times.
✗ Branch 1 not taken.
284564 $$= NEW_PTN PT_char_type(Char_type::CHAR, $2, $3.charset,
7138
1/2
✓ Branch 0 taken 142282 times.
✗ Branch 1 not taken.
284564 $3.force_binary);
7139 }
7140 | CHAR_SYM opt_charset_with_opt_binary
7141 {
7142
1/2
✓ Branch 0 taken 728 times.
✗ Branch 1 not taken.
1456 $$= NEW_PTN PT_char_type(Char_type::CHAR, $2.charset,
7143
1/2
✓ Branch 0 taken 728 times.
✗ Branch 1 not taken.
1456 $2.force_binary);
7144 }
7145 | nchar field_length opt_bin_mod
7146 {
7147
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
25 const CHARSET_INFO *cs= $3 ?
7148 get_bin_collation(national_charset_info) : national_charset_info;
7149
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
25 if (cs == NULL)
7150 MYSQL_YYABORT;
7151
2/4
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
25 $$= NEW_PTN PT_char_type(Char_type::CHAR, $2, cs);
7152
1/2
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
25 warn_about_deprecated_national(YYTHD);
7153 }
7154 | nchar opt_bin_mod
7155 {
7156
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
10 const CHARSET_INFO *cs= $2 ?
7157 get_bin_collation(national_charset_info) : national_charset_info;
7158
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
10 if (cs == NULL)
7159 MYSQL_YYABORT;
7160
2/4
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
10 $$= NEW_PTN PT_char_type(Char_type::CHAR, cs);
7161
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 warn_about_deprecated_national(YYTHD);
7162 }
7163 | BINARY_SYM field_length
7164 {
7165
2/4
✓ Branch 0 taken 2550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2550 times.
✗ Branch 3 not taken.
2550 $$= NEW_PTN PT_char_type(Char_type::CHAR, $2, &my_charset_bin);
7166 }
7167 | BINARY_SYM
7168 {
7169
2/4
✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 53 times.
✗ Branch 3 not taken.
53 $$= NEW_PTN PT_char_type(Char_type::CHAR, &my_charset_bin);
7170 }
7171 | varchar field_length opt_charset_with_opt_binary
7172 {
7173
1/2
✓ Branch 0 taken 1026210 times.
✗ Branch 1 not taken.
2052421 $$= NEW_PTN PT_char_type(Char_type::VARCHAR, $2, $3.charset,
7174
1/2
✓ Branch 0 taken 1026211 times.
✗ Branch 1 not taken.
2052420 $3.force_binary);
7175 }
7176 | nvarchar field_length opt_bin_mod
7177 {
7178
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 123 times.
123 const CHARSET_INFO *cs= $3 ?
7179 get_bin_collation(national_charset_info) : national_charset_info;
7180
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 123 times.
123 if (cs == NULL)
7181 MYSQL_YYABORT;
7182
2/4
✓ Branch 0 taken 123 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 123 times.
✗ Branch 3 not taken.
123 $$= NEW_PTN PT_char_type(Char_type::VARCHAR, $2, cs);
7183
1/2
✓ Branch 0 taken 123 times.
✗ Branch 1 not taken.
123 warn_about_deprecated_national(YYTHD);
7184 }
7185 | VARBINARY_SYM field_length
7186 {
7187
2/4
✓ Branch 0 taken 22595 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 22595 times.
✗ Branch 3 not taken.
22595 $$= NEW_PTN PT_char_type(Char_type::VARCHAR, $2, &my_charset_bin);
7188 }
7189 | YEAR_SYM opt_field_length field_options
7190 {
7191
2/2
✓ Branch 0 taken 116 times.
✓ Branch 1 taken 1477 times.
1593 if ($2)
7192 {
7193 116 errno= 0;
7194 116 ulong length= strtoul($2, NULL, 10);
7195
4/4
✓ Branch 0 taken 114 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 59 times.
✓ Branch 3 taken 55 times.
116 if (errno != 0 || length != 4)
7196 {
7197 /* Only support length is 4 */
7198
1/2
✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
61 my_error(ER_INVALID_YEAR_COLUMN_LENGTH, MYF(0), "YEAR");
7199 61 MYSQL_YYABORT;
7200 }
7201
1/2
✓ Branch 0 taken 55 times.
✗ Branch 1 not taken.
55 push_deprecated_warn(YYTHD, "YEAR(4)", "YEAR");
7202 }
7203
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1531 times.
1532 if ($3 == UNSIGNED_FLAG)
7204 {
7205
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 push_warning(YYTHD, Sql_condition::SL_WARNING,
7206 ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,
7207 ER_THD(YYTHD, ER_WARN_DEPRECATED_YEAR_UNSIGNED));
7208 }
7209 // We can ignore field length and UNSIGNED/ZEROFILL attributes here.
7210
2/4
✓ Branch 0 taken 1532 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1532 times.
✗ Branch 3 not taken.
1532 $$= NEW_PTN PT_year_type;
7211 }
7212 | DATE_SYM
7213 {
7214
2/4
✓ Branch 0 taken 3044 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3044 times.
✗ Branch 3 not taken.
3044 $$= NEW_PTN PT_date_type;
7215 }
7216 | TIME_SYM type_datetime_precision
7217 {
7218
2/4
✓ Branch 0 taken 3567 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3567 times.
✗ Branch 3 not taken.
3567 $$= NEW_PTN PT_time_type(Time_type::TIME, $2);
7219 }
7220 | TIMESTAMP_SYM type_datetime_precision
7221 {
7222
2/4
✓ Branch 0 taken 223438 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 223438 times.
✗ Branch 3 not taken.
223438 $$= NEW_PTN PT_timestamp_type($2);
7223 }
7224 | DATETIME_SYM type_datetime_precision
7225 {
7226
2/4
✓ Branch 0 taken 42364 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 42365 times.
✗ Branch 3 not taken.
42365 $$= NEW_PTN PT_time_type(Time_type::DATETIME, $2);
7227 }
7228 | TINYBLOB_SYM
7229 {
7230
2/4
✓ Branch 0 taken 901 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 901 times.
✗ Branch 3 not taken.
901 $$= NEW_PTN PT_blob_type(Blob_type::TINY, &my_charset_bin);
7231 }
7232 | BLOB_SYM opt_field_length
7233 {
7234
2/4
✓ Branch 0 taken 48089 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48089 times.
✗ Branch 3 not taken.
48089 $$= NEW_PTN PT_blob_type($2);
7235 }
7236 | spatial_type
7237 | MEDIUMBLOB_SYM
7238 {
7239
2/4
✓ Branch 0 taken 11659 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11659 times.
✗ Branch 3 not taken.
11659 $$= NEW_PTN PT_blob_type(Blob_type::MEDIUM, &my_charset_bin);
7240 }
7241 | LONGBLOB_SYM
7242 {
7243
2/4
✓ Branch 0 taken 69791 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69791 times.
✗ Branch 3 not taken.
69791 $$= NEW_PTN PT_blob_type(Blob_type::LONG, &my_charset_bin);
7244 }
7245 | LONG_SYM VARBINARY_SYM
7246 {
7247
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 $$= NEW_PTN PT_blob_type(Blob_type::MEDIUM, &my_charset_bin);
7248 }
7249 | LONG_SYM varchar opt_charset_with_opt_binary
7250 {
7251
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
12 $$= NEW_PTN PT_blob_type(Blob_type::MEDIUM, $3.charset,
7252
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
12 $3.force_binary);
7253 }
7254 | TINYTEXT_SYN opt_charset_with_opt_binary
7255 {
7256
1/2
✓ Branch 0 taken 1030 times.
✗ Branch 1 not taken.
2060 $$= NEW_PTN PT_blob_type(Blob_type::TINY, $2.charset,
7257
1/2
✓ Branch 0 taken 1030 times.
✗ Branch 1 not taken.
2060 $2.force_binary);
7258 }
7259 | TEXT_SYM opt_field_length opt_charset_with_opt_binary
7260 {
7261
1/2
✓ Branch 0 taken 97719 times.
✗ Branch 1 not taken.
195438 $$= NEW_PTN PT_char_type(Char_type::TEXT, $2, $3.charset,
7262
1/2
✓ Branch 0 taken 97719 times.
✗ Branch 1 not taken.
195438 $3.force_binary);
7263 }
7264 | MEDIUMTEXT_SYM opt_charset_with_opt_binary
7265 {
7266
1/2
✓ Branch 0 taken 284927 times.
✗ Branch 1 not taken.
569854 $$= NEW_PTN PT_blob_type(Blob_type::MEDIUM, $2.charset,
7267
1/2
✓ Branch 0 taken 284927 times.
✗ Branch 1 not taken.
569854 $2.force_binary);
7268 }
7269 | LONGTEXT_SYM opt_charset_with_opt_binary
7270 {
7271
1/2
✓ Branch 0 taken 126479 times.
✗ Branch 1 not taken.
252958 $$= NEW_PTN PT_blob_type(Blob_type::LONG, $2.charset,
7272
1/2
✓ Branch 0 taken 126479 times.
✗ Branch 1 not taken.
252958 $2.force_binary);
7273 }
7274 | ENUM_SYM '(' string_list ')' opt_charset_with_opt_binary
7275 {
7276
2/4
✓ Branch 0 taken 427719 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427719 times.
✗ Branch 3 not taken.
427719 $$= NEW_PTN PT_enum_type($3, $5.charset, $5.force_binary);
7277 }
7278 | SET_SYM '(' string_list ')' opt_charset_with_opt_binary
7279 {
7280
2/4
✓ Branch 0 taken 43655 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 43655 times.
✗ Branch 3 not taken.
43655 $$= NEW_PTN PT_set_type($3, $5.charset, $5.force_binary);
7281 }
7282 | LONG_SYM opt_charset_with_opt_binary
7283 {
7284
1/2
✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
166 $$= NEW_PTN PT_blob_type(Blob_type::MEDIUM, $2.charset,
7285
1/2
✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
166 $2.force_binary);
7286 }
7287 | SERIAL_SYM
7288 {
7289
2/4
✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 3 not taken.
58 $$= NEW_PTN PT_serial_type;
7290 }
7291 | JSON_SYM
7292 {
7293
2/4
✓ Branch 0 taken 83235 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 83235 times.
✗ Branch 3 not taken.
83235 $$= NEW_PTN PT_json_type;
7294 }
7295 ;
7296
7297 spatial_type:
7298 GEOMETRY_SYM
7299
2/4
✓ Branch 0 taken 562 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 562 times.
✗ Branch 3 not taken.
562 { $$= NEW_PTN PT_spacial_type(Field::GEOM_GEOMETRY); }
7300 | GEOMETRYCOLLECTION_SYM
7301
2/4
✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 50 times.
✗ Branch 3 not taken.
50 { $$= NEW_PTN PT_spacial_type(Field::GEOM_GEOMETRYCOLLECTION); }
7302 | POINT_SYM
7303
2/4
✓ Branch 0 taken 564 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 564 times.
✗ Branch 3 not taken.
564 { $$= NEW_PTN PT_spacial_type(Field::GEOM_POINT); }
7304 | MULTIPOINT_SYM
7305
2/4
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
✗ Branch 3 not taken.
52 { $$= NEW_PTN PT_spacial_type(Field::GEOM_MULTIPOINT); }
7306 | LINESTRING_SYM
7307
2/4
✓ Branch 0 taken 104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 104 times.
✗ Branch 3 not taken.
104 { $$= NEW_PTN PT_spacial_type(Field::GEOM_LINESTRING); }
7308 | MULTILINESTRING_SYM
7309
2/4
✓ Branch 0 taken 42 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 42 times.
✗ Branch 3 not taken.
42 { $$= NEW_PTN PT_spacial_type(Field::GEOM_MULTILINESTRING); }
7310 | POLYGON_SYM
7311
2/4
✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
77 { $$= NEW_PTN PT_spacial_type(Field::GEOM_POLYGON); }
7312 | MULTIPOLYGON_SYM
7313
2/4
✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 50 times.
✗ Branch 3 not taken.
50 { $$= NEW_PTN PT_spacial_type(Field::GEOM_MULTIPOLYGON); }
7314 ;
7315
7316 nchar:
7317 NCHAR_SYM {}
7318 | NATIONAL_SYM CHAR_SYM {}
7319 ;
7320
7321 varchar:
7322 CHAR_SYM VARYING {}
7323 | VARCHAR_SYM {}
7324 ;
7325
7326 nvarchar:
7327 NATIONAL_SYM VARCHAR_SYM {}
7328 | NVARCHAR_SYM {}
7329 | NCHAR_SYM VARCHAR_SYM {}
7330 | NATIONAL_SYM CHAR_SYM VARYING {}
7331 | NCHAR_SYM VARYING {}
7332 ;
7333
7334 int_type:
7335 680318 INT_SYM { $$=Int_type::INT; }
7336 33705 | TINYINT_SYM { $$=Int_type::TINYINT; }
7337 28834 | SMALLINT_SYM { $$=Int_type::SMALLINT; }
7338 6705 | MEDIUMINT_SYM { $$=Int_type::MEDIUMINT; }
7339 1362596 | BIGINT_SYM { $$=Int_type::BIGINT; }
7340 ;
7341
7342 real_type:
7343 REAL_SYM
7344 {
7345
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1270 times.
1271 $$= YYTHD->variables.sql_mode & MODE_REAL_AS_FLOAT ?
7346 Numeric_type::FLOAT : Numeric_type::DOUBLE;
7347 }
7348 | DOUBLE_SYM opt_PRECISION
7349 4343 { $$= Numeric_type::DOUBLE; }
7350 ;
7351
7352 opt_PRECISION:
7353 /* empty */
7354 | PRECISION
7355 ;
7356
7357 numeric_type:
7358 5733 FLOAT_SYM { $$= Numeric_type::FLOAT; }
7359 9609 | DECIMAL_SYM { $$= Numeric_type::DECIMAL; }
7360 2187 | NUMERIC_SYM { $$= Numeric_type::DECIMAL; }
7361 791 | FIXED_SYM { $$= Numeric_type::DECIMAL; }
7362 ;
7363
7364 standard_float_options:
7365 /* empty */
7366 {
7367 61 $$.length = nullptr;
7368 61 $$.dec = nullptr;
7369 }
7370 | field_length
7371 {
7372 5 $$.length = $1;
7373 5 $$.dec = nullptr;
7374 }
7375 ;
7376
7377 float_options:
7378 /* empty */
7379 {
7380 8047 $$.length= NULL;
7381 8047 $$.dec= NULL;
7382 }
7383 | field_length
7384 {
7385 1165 $$.length= $1;
7386 1165 $$.dec= NULL;
7387 }
7388 | precision
7389 ;
7390
7391 precision:
7392 '(' NUM ',' NUM ')'
7393 {
7394 11098 $$.length= $2.str;
7395 11098 $$.dec= $4.str;
7396 }
7397 ;
7398
7399
7400 type_datetime_precision:
7401 225456 /* empty */ { $$= NULL; }
7402 45710 | '(' NUM ')' { $$= $2.str; }
7403 ;
7404
7405 func_datetime_precision:
7406 105397 /* empty */ { $$= 0; }
7407 76786 | '(' ')' { $$= 0; }
7408 | '(' NUM ')'
7409 {
7410 int error;
7411
1/2
✓ Branch 0 taken 15612 times.
✗ Branch 1 not taken.
15612 $$= (ulong) my_strtoll10($2.str, NULL, &error);
7412 }
7413 ;
7414
7415 field_options:
7416 513497 /* empty */ { $$ = 0; }
7417 | field_opt_list
7418 ;
7419
7420 field_opt_list:
7421 field_opt_list field_option
7422 {
7423 1176 $$ = $1 | $2;
7424 }
7425 | field_option
7426 ;
7427
7428 field_option:
7429 2008 SIGNED_SYM { $$ = 0; } // TODO: remove undocumented ignored syntax
7430 1620945 | UNSIGNED_SYM { $$ = UNSIGNED_FLAG; }
7431 | ZEROFILL_SYM {
7432 2276 $$ = ZEROFILL_FLAG;
7433
2/4
✓ Branch 0 taken 2276 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2276 times.
✗ Branch 3 not taken.
2276 push_warning(YYTHD, Sql_condition::SL_WARNING,
7434 ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,
7435 ER_THD(YYTHD, ER_WARN_DEPRECATED_ZEROFILL));
7436 }
7437 ;
7438
7439 field_length:
7440 82 '(' LONG_NUM ')' { $$= $2.str; }
7441 | '(' ULONGLONG_NUM ')' { $$= $2.str; }
7442 19 | '(' DECIMAL_NUM ')' { $$= $2.str; }
7443 1276147 | '(' NUM ')' { $$= $2.str; };
7444
7445 opt_field_length:
7446 2268533 /* empty */ { $$= NULL; /* use default length */ }
7447 | field_length
7448 ;
7449
7450 opt_precision:
7451 /* empty */
7452 {
7453 4063 $$.length= NULL;
7454 4063 $$.dec = NULL;
7455 }
7456 | precision
7457 ;
7458
7459 opt_column_attribute_list:
7460 1474666 /* empty */ { $$= NULL; }
7461 | column_attribute_list
7462 ;
7463
7464 column_attribute_list:
7465 column_attribute_list column_attribute
7466 {
7467 911574 $$= $1;
7468
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 911574 times.
911574 if ($2 == nullptr)
7469 MYSQL_YYABORT; // OOM
7470
7471
3/4
✓ Branch 0 taken 911574 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 911557 times.
911574 if ($2->has_constraint_enforcement()) {
7472 // $2 is `[NOT] ENFORCED`
7473
3/4
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 16 times.
34 if ($1->back()->set_constraint_enforcement(
7474
2/4
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
✗ Branch 3 not taken.
17 $2->is_constraint_enforced())) {
7475 // $1 is not `CHECK(...)`
7476
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error_at(@2);
7477 1 MYSQL_YYABORT;
7478 }
7479 } else {
7480
2/4
✓ Branch 0 taken 911557 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 911557 times.
911557 if ($$->push_back($2))
7481 MYSQL_YYABORT; // OOM
7482 }
7483 }
7484 | column_attribute
7485 {
7486
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3219963 times.
3219963 if ($1 == nullptr)
7487 MYSQL_YYABORT; // OOM
7488
7489
3/4
✓ Branch 0 taken 3219963 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 3219961 times.
3219963 if ($1->has_constraint_enforcement()) {
7490 // [NOT] ENFORCED doesn't follow the CHECK clause
7491
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 YYTHD->syntax_error_at(@1);
7492 2 MYSQL_YYABORT;
7493 }
7494
7495 3219961 $$=
7496
2/4
✓ Branch 0 taken 3219962 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3219961 times.
✗ Branch 3 not taken.
3219961 NEW_PTN Mem_root_array<PT_column_attr_base *>(YYMEM_ROOT);
7497
4/8
✓ Branch 0 taken 3219961 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3219961 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3219962 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 3219961 times.
3219961 if ($$ == NULL || $$->push_back($1))
7498 MYSQL_YYABORT; // OOM
7499 }
7500 ;
7501
7502 column_attribute:
7503 NULL_SYM
7504 {
7505
2/4
✓ Branch 0 taken 63534 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 63534 times.
✗ Branch 3 not taken.
63534 $$= NEW_PTN PT_null_column_attr;
7506 }
7507 | not NULL_SYM
7508 {
7509
2/4
✓ Branch 0 taken 2887876 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2887876 times.
✗ Branch 3 not taken.
2887876 $$= NEW_PTN PT_not_null_column_attr;
7510 }
7511 | not SECONDARY_SYM
7512 {
7513
2/4
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
✗ Branch 3 not taken.
32 $$= NEW_PTN PT_secondary_column_attr;
7514 }
7515 | DEFAULT_SYM now_or_signed_literal
7516 {
7517
2/4
✓ Branch 0 taken 306496 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 306496 times.
✗ Branch 3 not taken.
306496 $$= NEW_PTN PT_default_column_attr($2);
7518 }
7519 | DEFAULT_SYM '(' expr ')'
7520 {
7521
2/4
✓ Branch 0 taken 311 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 311 times.
✗ Branch 3 not taken.
311 $$= NEW_PTN PT_generated_default_val_column_attr($3);
7522 }
7523 | ON_SYM UPDATE_SYM now
7524 {
7525
2/4
✓ Branch 0 taken 33832 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 33832 times.
✗ Branch 3 not taken.
33832 $$= NEW_PTN PT_on_update_column_attr(static_cast<uint8>($3));
7526 }
7527 | AUTO_INC
7528 {
7529
2/4
✓ Branch 0 taken 196492 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196492 times.
✗ Branch 3 not taken.
196492 $$= NEW_PTN PT_auto_increment_column_attr;
7530 }
7531 | SERIAL_SYM DEFAULT_SYM VALUE_SYM
7532 {
7533 $$= NEW_PTN PT_serial_default_value_column_attr;
7534 }
7535 | opt_primary KEY_SYM
7536 {
7537
2/4
✓ Branch 0 taken 57964 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 57964 times.
✗ Branch 3 not taken.
57964 $$= NEW_PTN PT_primary_key_column_attr;
7538 }
7539 | UNIQUE_SYM
7540 {
7541
1/2
✓ Branch 0 taken 422 times.
✗ Branch 1 not taken.
422 $$= NEW_PTN PT_unique_combo_clustering_key_column_attr(KEYTYPE_UNIQUE);
7542 }
7543 | UNIQUE_SYM KEY_SYM
7544 {
7545
1/2
✓ Branch 0 taken 2197 times.
✗ Branch 1 not taken.
2197 $$= NEW_PTN PT_unique_combo_clustering_key_column_attr(KEYTYPE_UNIQUE);
7546 }
7547 | CLUSTERING_SYM
7548 {
7549
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 $$= NEW_PTN PT_unique_combo_clustering_key_column_attr(KEYTYPE_CLUSTERING);
7550 }
7551 | CLUSTERING_SYM KEY_SYM
7552 {
7553
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$= NEW_PTN PT_unique_combo_clustering_key_column_attr(KEYTYPE_CLUSTERING);
7554 }
7555 | COMMENT_SYM TEXT_STRING_sys
7556 {
7557
2/4
✓ Branch 0 taken 117787 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 117787 times.
✗ Branch 3 not taken.
117787 $$= NEW_PTN PT_comment_column_attr(to_lex_cstring($2));
7558 }
7559 | COLLATE_SYM collation_name
7560 {
7561
2/4
✓ Branch 0 taken 460747 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 460747 times.
✗ Branch 3 not taken.
460747 $$= NEW_PTN PT_collate_column_attr(@2, $2);
7562 }
7563 | COLUMN_FORMAT_SYM column_format
7564 {
7565
1/2
✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
45 $$= NEW_PTN PT_column_format_column_attr($2, null_lex_cstr);
7566 }
7567 | COLUMN_FORMAT_SYM COMPRESSED_SYM opt_with_compression_dictionary
7568 {
7569
1/2
✓ Branch 0 taken 2442 times.
✗ Branch 1 not taken.
2442 $$= NEW_PTN PT_column_format_column_attr(COLUMN_FORMAT_TYPE_COMPRESSED, $3);
7570 }
7571 | STORAGE_SYM storage_media
7572 {
7573
2/4
✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 44 times.
✗ Branch 3 not taken.
44 $$= NEW_PTN PT_storage_media_column_attr($2);
7574 }
7575 | SRID_SYM real_ulonglong_num
7576 {
7577
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 687 times.
688 if ($2 > std::numeric_limits<gis::srid_t>::max())
7578 {
7579
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_DATA_OUT_OF_RANGE, MYF(0), "SRID", "SRID");
7580 1 MYSQL_YYABORT;
7581 }
7582
2/4
✓ Branch 0 taken 687 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 687 times.
✗ Branch 3 not taken.
687 $$= NEW_PTN PT_srid_column_attr(static_cast<gis::srid_t>($2));
7583 }
7584 | opt_constraint_name check_constraint
7585 /* See the next branch for [NOT] ENFORCED. */
7586 {
7587
2/4
✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 216 times.
✗ Branch 3 not taken.
216 $$= NEW_PTN PT_check_constraint_column_attr($1, $2);
7588 }
7589 | constraint_enforcement
7590 /*
7591 This branch is needed to workaround the need of a lookahead of 2 for
7592 the grammar:
7593
7594 { [NOT] NULL | CHECK(...) [NOT] ENFORCED } ...
7595
7596 Note: the column_attribute_list rule rejects all unexpected
7597 [NOT] ENFORCED sequences.
7598 */
7599 {
7600
2/4
✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19 times.
✗ Branch 3 not taken.
19 $$ = NEW_PTN PT_constraint_enforcement_attr($1);
7601 }
7602 | ENGINE_ATTRIBUTE_SYM opt_equal json_attribute
7603 {
7604
1/2
✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
49 $$ = make_column_engine_attribute(YYMEM_ROOT, $3);
7605 }
7606 | SECONDARY_ENGINE_ATTRIBUTE_SYM opt_equal json_attribute
7607 {
7608
1/2
✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
60 $$ = make_column_secondary_engine_attribute(YYMEM_ROOT, $3);
7609 }
7610 | visibility
7611 {
7612
2/4
✓ Branch 0 taken 279 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 279 times.
✗ Branch 3 not taken.
279 $$ = NEW_PTN PT_column_visibility_attr($1);
7613 }
7614 ;
7615
7616 opt_with_compression_dictionary:
7617 2040 /* empty */ { $$= null_lex_cstr; }
7618 | WITH COMPRESSION_DICTIONARY_SYM ident
7619 {
7620 402 $$= to_lex_cstring($3);
7621 }
7622 ;
7623
7624 column_format:
7625 14 DEFAULT_SYM { $$= COLUMN_FORMAT_TYPE_DEFAULT; }
7626 15 | FIXED_SYM { $$= COLUMN_FORMAT_TYPE_FIXED; }
7627 16 | DYNAMIC_SYM { $$= COLUMN_FORMAT_TYPE_DYNAMIC; }
7628 ;
7629
7630 storage_media:
7631 5 DEFAULT_SYM { $$= HA_SM_DEFAULT; }
7632 19 | DISK_SYM { $$= HA_SM_DISK; }
7633 20 | MEMORY_SYM { $$= HA_SM_MEMORY; }
7634 ;
7635
7636 now:
7637 NOW_SYM func_datetime_precision
7638 {
7639 196259 $$= $2;
7640 };
7641
7642 now_or_signed_literal:
7643 now
7644 {
7645
2/4
✓ Branch 0 taken 44183 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 44183 times.
✗ Branch 3 not taken.
44183 $$= NEW_PTN Item_func_now_local(@$, static_cast<uint8>($1));
7646 }
7647 | signed_literal_or_null
7648 ;
7649
7650 character_set:
7651 CHAR_SYM SET_SYM
7652 | CHARSET
7653 ;
7654
7655 charset_name:
7656 ident_or_text
7657 {
7658
3/4
✓ Branch 0 taken 750896 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 750886 times.
750896 if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))))
7659 {
7660
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
7661 10 MYSQL_YYABORT;
7662 }
7663
1/2
✓ Branch 0 taken 750886 times.
✗ Branch 1 not taken.
750886 YYLIP->warn_on_deprecated_charset($$, $1.str);
7664 }
7665 303 | BINARY_SYM { $$= &my_charset_bin; }
7666 ;
7667
7668 opt_load_data_charset:
7669 43049 /* Empty */ { $$= NULL; }
7670 12763 | character_set charset_name { $$ = $2; }
7671 ;
7672
7673 old_or_new_charset_name:
7674 ident_or_text
7675 {
7676
5/6
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 25 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 31 times.
39 if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))) &&
7677
3/4
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 6 times.
7 !($$=get_old_charset_by_name($1.str)))
7678 {
7679
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
7680 1 MYSQL_YYABORT;
7681 }
7682 }
7683 1 | BINARY_SYM { $$= &my_charset_bin; }
7684 ;
7685
7686 old_or_new_charset_name_or_default:
7687 32 old_or_new_charset_name { $$=$1; }
7688 11 | DEFAULT_SYM { $$=NULL; }
7689 ;
7690
7691 collation_name:
7692 ident_or_text
7693 {
7694
3/4
✓ Branch 0 taken 810451 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
✓ Branch 3 taken 810438 times.
810451 if (!($$= mysqld_collation_get_by_name($1.str)))
7695 13 MYSQL_YYABORT;
7696
1/2
✓ Branch 0 taken 810438 times.
✗ Branch 1 not taken.
810438 YYLIP->warn_on_deprecated_collation($$);
7697 }
7698 5 | BINARY_SYM { $$= &my_charset_bin; }
7699 ;
7700
7701 opt_collate:
7702 339567 /* empty */ { $$ = nullptr; }
7703 1457 | COLLATE_SYM collation_name { $$ = $2; }
7704 ;
7705
7706 opt_default:
7707 /* empty */ {}
7708 | DEFAULT_SYM {}
7709 ;
7710
7711
7712 ascii:
7713 ASCII_SYM {
7714
1/2
✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
82 push_deprecated_warn(YYTHD, "ASCII", "CHARACTER SET charset_name");
7715 82 $$= &my_charset_latin1;
7716 }
7717 | BINARY_SYM ASCII_SYM {
7718
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 warn_about_deprecated_binary(YYTHD);
7719
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 push_deprecated_warn(YYTHD, "ASCII", "CHARACTER SET charset_name");
7720 3 $$= &my_charset_latin1_bin;
7721 }
7722 | ASCII_SYM BINARY_SYM {
7723
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 push_deprecated_warn(YYTHD, "ASCII", "CHARACTER SET charset_name");
7724
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 warn_about_deprecated_binary(YYTHD);
7725 3 $$= &my_charset_latin1_bin;
7726 }
7727 ;
7728
7729 unicode:
7730 UNICODE_SYM
7731 {
7732
1/2
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
37 push_deprecated_warn(YYTHD, "UNICODE", "CHARACTER SET charset_name");
7733
2/4
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 37 times.
37 if (!($$= get_charset_by_csname("ucs2", MY_CS_PRIMARY,MYF(0))))
7734 {
7735 my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2");
7736 MYSQL_YYABORT;
7737 }
7738 }
7739 | UNICODE_SYM BINARY_SYM
7740 {
7741
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 push_deprecated_warn(YYTHD, "UNICODE", "CHARACTER SET charset_name");
7742
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 warn_about_deprecated_binary(YYTHD);
7743
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
3 if (!($$= mysqld_collation_get_by_name("ucs2_bin")))
7744 MYSQL_YYABORT;
7745 }
7746 | BINARY_SYM UNICODE_SYM
7747 {
7748
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 warn_about_deprecated_binary(YYTHD);
7749
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 push_deprecated_warn(YYTHD, "UNICODE", "CHARACTER SET charset_name");
7750
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
2 if (!($$= mysqld_collation_get_by_name("ucs2_bin")))
7751 my_error(ER_UNKNOWN_COLLATION, MYF(0), "ucs2_bin");
7752 }
7753 ;
7754
7755 opt_charset_with_opt_binary:
7756 /* empty */
7757 {
7758 1980872 $$.charset= NULL;
7759 1980872 $$.force_binary= false;
7760 }
7761 | ascii
7762 {
7763 88 $$.charset= $1;
7764 88 $$.force_binary= false;
7765 }
7766 | unicode
7767 {
7768 42 $$.charset= $1;
7769 42 $$.force_binary= false;
7770 }
7771 | BYTE_SYM
7772 {
7773 10 $$.charset= &my_charset_bin;
7774 10 $$.force_binary= false;
7775 }
7776 | character_set charset_name opt_bin_mod
7777 {
7778
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 249028 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
249029 $$.charset= $3 ? get_bin_collation($2) : $2;
7779
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 249029 times.
249029 if ($$.charset == NULL)
7780 MYSQL_YYABORT;
7781 249029 $$.force_binary= false;
7782 }
7783 | BINARY_SYM
7784 {
7785
1/2
✓ Branch 0 taken 8577 times.
✗ Branch 1 not taken.
8577 warn_about_deprecated_binary(YYTHD);
7786 8577 $$.charset= NULL;
7787 8577 $$.force_binary= true;
7788 }
7789 | BINARY_SYM character_set charset_name
7790 {
7791
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 warn_about_deprecated_binary(YYTHD);
7792
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 $$.charset= get_bin_collation($3);
7793
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if ($$.charset == NULL)
7794 MYSQL_YYABORT;
7795 5 $$.force_binary= false;
7796 }
7797 ;
7798
7799 opt_bin_mod:
7800 249186 /* empty */ { $$= false; }
7801 | BINARY_SYM {
7802
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 warn_about_deprecated_binary(YYTHD);
7803 1 $$= true;
7804 }
7805 ;
7806
7807 ws_num_codepoints:
7808 '(' real_ulong_num
7809 {
7810
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 576 times.
577 if ($2 == 0)
7811 {
7812
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error();
7813 1 MYSQL_YYABORT;
7814 }
7815 }
7816 ')'
7817 576 { $$= $2; }
7818 ;
7819
7820 opt_primary:
7821 /* empty */
7822 | PRIMARY_SYM
7823 ;
7824
7825 references:
7826 REFERENCES
7827 table_ident
7828 opt_ref_list
7829 opt_match_clause
7830 opt_on_update_delete
7831 {
7832 497647 $$.table_name= $2;
7833 497647 $$.reference_list= $3;
7834 497647 $$.fk_match_option= $4;
7835 497647 $$.fk_update_opt= $5.fk_update_opt;
7836 497647 $$.fk_delete_opt= $5.fk_delete_opt;
7837 }
7838 ;
7839
7840 opt_ref_list:
7841 3 /* empty */ { $$= NULL; }
7842 497648 | '(' reference_list ')' { $$= $2; }
7843 ;
7844
7845 reference_list:
7846 reference_list ',' ident
7847 {
7848 511 $$= $1;
7849
1/2
✓ Branch 0 taken 511 times.
✗ Branch 1 not taken.
511 auto key= NEW_PTN Key_part_spec(to_lex_cstring($3), 0, ORDER_ASC);
7850
4/8
✓ Branch 0 taken 511 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 511 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 511 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 511 times.
511 if (key == NULL || $$->push_back(key))
7851 MYSQL_YYABORT;
7852 }
7853 | ident
7854 {
7855
1/2
✓ Branch 0 taken 497648 times.
✗ Branch 1 not taken.
497648 $$= NEW_PTN List<Key_part_spec>;
7856
1/2
✓ Branch 0 taken 497648 times.
✗ Branch 1 not taken.
497648 auto key= NEW_PTN Key_part_spec(to_lex_cstring($1), 0, ORDER_ASC);
7857
5/10
✓ Branch 0 taken 497648 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 497648 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 497648 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 497648 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 497648 times.
497648 if ($$ == NULL || key == NULL || $$->push_back(key))
7858 MYSQL_YYABORT;
7859 }
7860 ;
7861
7862 opt_match_clause:
7863 497647 /* empty */ { $$= FK_MATCH_UNDEF; }
7864 3 | MATCH FULL { $$= FK_MATCH_FULL; }
7865 1 | MATCH PARTIAL { $$= FK_MATCH_PARTIAL; }
7866 | MATCH SIMPLE_SYM { $$= FK_MATCH_SIMPLE; }
7867 ;
7868
7869 opt_on_update_delete:
7870 /* empty */
7871 {
7872 496158 $$.fk_update_opt= FK_OPTION_UNDEF;
7873 496158 $$.fk_delete_opt= FK_OPTION_UNDEF;
7874 }
7875 | ON_SYM UPDATE_SYM delete_option
7876 {
7877 810 $$.fk_update_opt= $3;
7878 810 $$.fk_delete_opt= FK_OPTION_UNDEF;
7879 }
7880 | ON_SYM DELETE_SYM delete_option
7881 {
7882 206 $$.fk_update_opt= FK_OPTION_UNDEF;
7883 206 $$.fk_delete_opt= $3;
7884 }
7885 | ON_SYM UPDATE_SYM delete_option
7886 ON_SYM DELETE_SYM delete_option
7887 {
7888 33 $$.fk_update_opt= $3;
7889 33 $$.fk_delete_opt= $6;
7890 }
7891 | ON_SYM DELETE_SYM delete_option
7892 ON_SYM UPDATE_SYM delete_option
7893 {
7894 440 $$.fk_update_opt= $6;
7895 440 $$.fk_delete_opt= $3;
7896 }
7897 ;
7898
7899 delete_option:
7900 754 RESTRICT { $$= FK_OPTION_RESTRICT; }
7901 471 | CASCADE { $$= FK_OPTION_CASCADE; }
7902 675 | SET_SYM NULL_SYM { $$= FK_OPTION_SET_NULL; }
7903 56 | NO_SYM ACTION { $$= FK_OPTION_NO_ACTION; }
7904 10 | SET_SYM DEFAULT_SYM { $$= FK_OPTION_DEFAULT; }
7905 ;
7906
7907 constraint_key_type:
7908 352616 PRIMARY_SYM KEY_SYM { $$= KEYTYPE_PRIMARY; }
7909 351490 | unique_combo_clustering opt_key_or_index { $$= $1; }
7910
7911 ;
7912
7913 key_or_index:
7914 KEY_SYM {}
7915 | INDEX_SYM {}
7916 ;
7917
7918 opt_key_or_index:
7919 /* empty */ {}
7920 | key_or_index
7921 ;
7922
7923 keys_or_index:
7924 KEYS {}
7925 | INDEX_SYM {}
7926 | INDEXES {}
7927 ;
7928
7929 opt_unique_combo_clustering:
7930 3714 /* empty */ { $$= KEYTYPE_MULTIPLE; }
7931 | unique_combo_clustering
7932 ;
7933
7934 unique_combo_clustering:
7935 UNIQUE_SYM
7936 {
7937 8340 $$= KEYTYPE_UNIQUE;
7938 }
7939 | UNIQUE_SYM KEY_SYM
7940 {
7941 345425 $$= KEYTYPE_UNIQUE;
7942 }
7943 | CLUSTERING_SYM
7944 {
7945 6 $$= static_cast<keytype>(KEYTYPE_MULTIPLE | KEYTYPE_CLUSTERING);
7946 }
7947 | CLUSTERING_SYM KEY_SYM
7948 {
7949 3 $$= static_cast<keytype>(KEYTYPE_MULTIPLE | KEYTYPE_CLUSTERING);
7950 }
7951 | UNIQUE_SYM CLUSTERING_SYM
7952 {
7953 2 $$= static_cast<keytype>(KEYTYPE_UNIQUE | KEYTYPE_CLUSTERING);
7954 }
7955 | UNIQUE_SYM CLUSTERING_SYM KEY_SYM
7956 {
7957 2 $$= static_cast<keytype>(KEYTYPE_UNIQUE | KEYTYPE_CLUSTERING);
7958 }
7959 | CLUSTERING_SYM UNIQUE_SYM
7960 {
7961 2 $$= static_cast<keytype>(KEYTYPE_UNIQUE | KEYTYPE_CLUSTERING);
7962 }
7963 | CLUSTERING_SYM UNIQUE_SYM KEY_SYM
7964 {
7965 2 $$= static_cast<keytype>(KEYTYPE_UNIQUE | KEYTYPE_CLUSTERING);
7966 }
7967
7968 opt_fulltext_index_options:
7969 848 /* Empty. */ { $$.init(YYMEM_ROOT); }
7970 | fulltext_index_options
7971 ;
7972
7973 fulltext_index_options:
7974 fulltext_index_option
7975 {
7976 296 $$.init(YYMEM_ROOT);
7977
2/4
✓ Branch 0 taken 296 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 296 times.
296 if ($$.push_back($1))
7978 MYSQL_YYABORT; // OOM
7979 }
7980 | fulltext_index_options fulltext_index_option
7981 {
7982 if ($1.push_back($2))
7983 MYSQL_YYABORT; // OOM
7984 $$= $1;
7985 }
7986 ;
7987
7988 fulltext_index_option:
7989 common_index_option
7990 | WITH PARSER_SYM IDENT_sys
7991 {
7992 300 LEX_CSTRING plugin_name= {$3.str, $3.length};
7993
3/4
✓ Branch 0 taken 300 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 296 times.
300 if (!plugin_is_ready(plugin_name, MYSQL_FTPARSER_PLUGIN))
7994 {
7995
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), $3.str);
7996 4 MYSQL_YYABORT;
7997 }
7998 else
7999
1/2
✓ Branch 0 taken 296 times.
✗ Branch 1 not taken.
296 $$= NEW_PTN PT_fulltext_index_parser_name(to_lex_cstring($3));
8000 }
8001 ;
8002
8003 opt_spatial_index_options:
8004 576 /* Empty. */ { $$.init(YYMEM_ROOT); }
8005 | spatial_index_options
8006 ;
8007
8008 spatial_index_options:
8009 spatial_index_option
8010 {
8011 15 $$.init(YYMEM_ROOT);
8012
2/4
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 15 times.
15 if ($$.push_back($1))
8013 MYSQL_YYABORT; // OOM
8014 }
8015 | spatial_index_options spatial_index_option
8016 {
8017
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
3 if ($1.push_back($2))
8018 MYSQL_YYABORT; // OOM
8019 3 $$= $1;
8020 }
8021 ;
8022
8023 spatial_index_option:
8024 common_index_option
8025 ;
8026
8027 opt_index_options:
8028 1056693 /* Empty. */ { $$.init(YYMEM_ROOT); }
8029 | index_options
8030 ;
8031
8032 index_options:
8033 index_option
8034 {
8035 50083 $$.init(YYMEM_ROOT);
8036
2/4
✓ Branch 0 taken 50083 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 50083 times.
50083 if ($$.push_back($1))
8037 MYSQL_YYABORT; // OOM
8038 }
8039 | index_options index_option
8040 {
8041
2/4
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 28 times.
28 if ($1.push_back($2))
8042 MYSQL_YYABORT; // OOM
8043 28 $$= $1;
8044 }
8045 ;
8046
8047 index_option:
8048 251 common_index_option { $$= $1; }
8049 49860 | index_type_clause { $$= $1; }
8050 ;
8051
8052 // These options are common for all index types.
8053 common_index_option:
8054
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 KEY_BLOCK_SIZE opt_equal ulong_num { $$= NEW_PTN PT_block_size($3); }
8055 | COMMENT_SYM TEXT_STRING_sys
8056 {
8057
1/2
✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
143 $$= NEW_PTN PT_index_comment(to_lex_cstring($2));
8058 }
8059 | visibility
8060 {
8061
1/2
✓ Branch 0 taken 70 times.
✗ Branch 1 not taken.
70 $$= NEW_PTN PT_index_visibility($1);
8062 }
8063 | ENGINE_ATTRIBUTE_SYM opt_equal json_attribute
8064 {
8065
1/2
✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
23 $$ = make_index_engine_attribute(YYMEM_ROOT, $3);
8066 }
8067 | SECONDARY_ENGINE_ATTRIBUTE_SYM opt_equal json_attribute
8068 {
8069
1/2
✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
23 $$ = make_index_secondary_engine_attribute(YYMEM_ROOT, $3);
8070 }
8071 ;
8072
8073 /*
8074 The syntax for defining an index is:
8075
8076 ... INDEX [index_name] [USING|TYPE] <index_type> ...
8077
8078 The problem is that whereas USING is a reserved word, TYPE is not. We can
8079 still handle it if an index name is supplied, i.e.:
8080
8081 ... INDEX type TYPE <index_type> ...
8082
8083 here the index's name is unmbiguously 'type', but for this:
8084
8085 ... INDEX TYPE <index_type> ...
8086
8087 it's impossible to know what this actually mean - is 'type' the name or the
8088 type? For this reason we accept the TYPE syntax only if a name is supplied.
8089 */
8090 opt_index_name_and_type:
8091 1100466 opt_ident { $$= {$1, NULL}; }
8092
1/2
✓ Branch 0 taken 321 times.
✗ Branch 1 not taken.
321 | opt_ident USING index_type { $$= {$1, NEW_PTN PT_index_type($3)}; }
8093 | ident TYPE_SYM index_type { $$= {$1, NEW_PTN PT_index_type($3)}; }
8094 ;
8095
8096 opt_index_type_clause:
8097 5983 /* empty */ { $$ = nullptr; }
8098 | index_type_clause
8099 ;
8100
8101 index_type_clause:
8102
1/2
✓ Branch 0 taken 49879 times.
✗ Branch 1 not taken.
49879 USING index_type { $$= NEW_PTN PT_index_type($2); }
8103
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 | TYPE_SYM index_type { $$= NEW_PTN PT_index_type($2); }
8104 ;
8105
8106 visibility:
8107 103 VISIBLE_SYM { $$= true; }
8108 413 | INVISIBLE_SYM { $$= false; }
8109 ;
8110
8111 index_type:
8112 239 BTREE_SYM { $$= HA_KEY_ALG_BTREE; }
8113 11 | RTREE_SYM { $$= HA_KEY_ALG_RTREE; }
8114 49954 | HASH_SYM { $$= HA_KEY_ALG_HASH; }
8115 ;
8116
8117 key_list:
8118 key_list ',' key_part
8119 {
8120
2/4
✓ Branch 0 taken 509 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 509 times.
509 if ($1->push_back($3))
8121 MYSQL_YYABORT; // OOM
8122 509 $$= $1;
8123 }
8124 | key_part
8125 {
8126 // The order is ignored.
8127
1/2
✓ Branch 0 taken 497645 times.
✗ Branch 1 not taken.
497645 $$= NEW_PTN List<PT_key_part_specification>;
8128
4/8
✓ Branch 0 taken 497645 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 497645 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 497645 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 497645 times.
497645 if ($$ == NULL || $$->push_back($1))
8129 MYSQL_YYABORT; // OOM
8130 }
8131 ;
8132
8133 key_part:
8134 ident opt_ordering_direction
8135 {
8136
2/4
✓ Branch 0 taken 2290126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2290126 times.
✗ Branch 3 not taken.
2290125 $$= NEW_PTN PT_key_part_specification(to_lex_cstring($1), $2, 0);
8137
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2290126 times.
2290126 if ($$ == NULL)
8138 MYSQL_YYABORT;
8139 }
8140 | ident '(' NUM ')' opt_ordering_direction
8141 {
8142 3471 int key_part_length= atoi($3.str);
8143
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3470 times.
3471 if (!key_part_length)
8144 {
8145
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_KEY_PART_0, MYF(0), $1.str);
8146 }
8147 3471 $$= NEW_PTN PT_key_part_specification(to_lex_cstring($1), $5,
8148
2/4
✓ Branch 0 taken 3471 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3471 times.
✗ Branch 3 not taken.
3471 key_part_length);
8149
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3471 times.
3471 if ($$ == NULL)
8150 MYSQL_YYABORT; /* purecov: deadcode */
8151 }
8152 ;
8153
8154 key_list_with_expression:
8155 key_list_with_expression ',' key_part_with_expression
8156 {
8157
2/4
✓ Branch 0 taken 687521 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 687521 times.
687521 if ($1->push_back($3))
8158 MYSQL_YYABORT; /* purecov: deadcode */
8159 687521 $$= $1;
8160 }
8161 | key_part_with_expression
8162 {
8163 // The order is ignored.
8164
1/2
✓ Branch 0 taken 1108524 times.
✗ Branch 1 not taken.
1108524 $$= NEW_PTN List<PT_key_part_specification>;
8165
4/8
✓ Branch 0 taken 1108525 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1108525 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1108525 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1108525 times.
1108525 if ($$ == NULL || $$->push_back($1))
8166 MYSQL_YYABORT; /* purecov: deadcode */
8167 }
8168 ;
8169
8170 key_part_with_expression:
8171 key_part
8172 | '(' expr ')' opt_ordering_direction
8173 {
8174
2/4
✓ Branch 0 taken 603 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 603 times.
✗ Branch 3 not taken.
603 $$= NEW_PTN PT_key_part_specification($2, $4);
8175
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 603 times.
603 if ($$ == NULL)
8176 MYSQL_YYABORT;
8177 }
8178 ;
8179
8180 opt_ident:
8181 1557118 /* empty */ { $$= NULL_STR; }
8182 | ident
8183 ;
8184
8185 string_list:
8186 text_string
8187 {
8188
1/2
✓ Branch 0 taken 471374 times.
✗ Branch 1 not taken.
471374 $$= NEW_PTN List<String>;
8189
4/8
✓ Branch 0 taken 471374 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 471374 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 471374 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 471374 times.
471374 if ($$ == NULL || $$->push_back($1))
8190 MYSQL_YYABORT; // OOM
8191 }
8192 | string_list ',' text_string
8193 {
8194
2/4
✓ Branch 0 taken 3040304 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3040304 times.
3040304 if ($$->push_back($3))
8195 MYSQL_YYABORT;
8196 }
8197 ;
8198
8199 /*
8200 ** Alter table
8201 */
8202
8203 alter_table_stmt:
8204 ALTER TABLE_SYM table_ident opt_alter_table_actions
8205 {
8206
1/2
✓ Branch 0 taken 77287 times.
✗ Branch 1 not taken.
154573 $$= NEW_PTN PT_alter_table_stmt(
8207 YYMEM_ROOT,
8208 77287 $1,
8209 77287 $3,
8210 $4.actions,
8211
1/2
✓ Branch 0 taken 77286 times.
✗ Branch 1 not taken.
77286 $4.flags.algo.get_or_default(),
8212
1/2
✓ Branch 0 taken 77287 times.
✗ Branch 1 not taken.
77286 $4.flags.lock.get_or_default(),
8213
2/4
✓ Branch 0 taken 77287 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77286 times.
✗ Branch 3 not taken.
154574 $4.flags.validation.get_or_default());
8214 }
8215 | ALTER TABLE_SYM table_ident standalone_alter_table_action
8216 {
8217
1/2
✓ Branch 0 taken 3073 times.
✗ Branch 1 not taken.
6146 $$= NEW_PTN PT_alter_table_standalone_stmt(
8218 YYMEM_ROOT,
8219 3073 $1,
8220 3073 $3,
8221 $4.action,
8222
1/2
✓ Branch 0 taken 3073 times.
✗ Branch 1 not taken.
3073 $4.flags.algo.get_or_default(),
8223
1/2
✓ Branch 0 taken 3073 times.
✗ Branch 1 not taken.
3073 $4.flags.lock.get_or_default(),
8224
2/4
✓ Branch 0 taken 3073 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3073 times.
✗ Branch 3 not taken.
6146 $4.flags.validation.get_or_default());
8225 }
8226 ;
8227
8228 alter_database_stmt:
8229 ALTER DATABASE ident_or_empty
8230 {
8231
1/2
✓ Branch 0 taken 1004 times.
✗ Branch 1 not taken.
1004 Lex->create_info= YYTHD->alloc_typed<HA_CREATE_INFO>();
8232
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1004 times.
1004 if (Lex->create_info == NULL)
8233 MYSQL_YYABORT; // OOM
8234 1004 Lex->create_info->default_table_charset= NULL;
8235 1004 Lex->create_info->used_fields= 0;
8236 }
8237 alter_database_options
8238 {
8239 985 LEX *lex=Lex;
8240 985 lex->sql_command=SQLCOM_ALTER_DB;
8241 985 lex->name= $3;
8242
4/4
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 975 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 984 times.
995 if (lex->name.str == NULL &&
8243
3/4
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 9 times.
10 lex->copy_db_to(&lex->name.str, &lex->name.length))
8244 1 MYSQL_YYABORT;
8245 }
8246 ;
8247
8248 alter_procedure_stmt:
8249 ALTER PROCEDURE_SYM sp_name
8250 {
8251 216 LEX *lex= Lex;
8252
8253
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 215 times.
216 if (lex->sphead)
8254 {
8255
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE");
8256 1 MYSQL_YYABORT;
8257 }
8258 215 memset(&lex->sp_chistics, 0, sizeof(st_sp_chistics));
8259 }
8260 sp_a_chistics
8261 {
8262 215 LEX *lex=Lex;
8263
8264 215 lex->sql_command= SQLCOM_ALTER_PROCEDURE;
8265 215 lex->spname= $3;
8266 }
8267 ;
8268
8269 alter_function_stmt:
8270 ALTER FUNCTION_SYM sp_name
8271 {
8272 177 LEX *lex= Lex;
8273
8274
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 176 times.
177 if (lex->sphead)
8275 {
8276
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
8277 1 MYSQL_YYABORT;
8278 }
8279 176 memset(&lex->sp_chistics, 0, sizeof(st_sp_chistics));
8280 }
8281 sp_a_chistics
8282 {
8283 176 LEX *lex=Lex;
8284
8285 176 lex->sql_command= SQLCOM_ALTER_FUNCTION;
8286 176 lex->spname= $3;
8287 }
8288 ;
8289
8290 alter_view_stmt:
8291 ALTER view_algorithm definer_opt
8292 {
8293 7791 LEX *lex= Lex;
8294
8295
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7791 times.
7791 if (lex->sphead)
8296 {
8297 my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW");
8298 MYSQL_YYABORT;
8299 }
8300 7791 lex->create_view_mode= enum_view_create_mode::VIEW_ALTER;
8301 }
8302 view_tail
8303 {}
8304 | ALTER definer_opt
8305 /*
8306 We have two separate rules for ALTER VIEW rather that
8307 optional view_algorithm above, to resolve the ambiguity
8308 with the ALTER EVENT below.
8309 */
8310 {
8311 142 LEX *lex= Lex;
8312
8313
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 139 times.
142 if (lex->sphead)
8314 {
8315
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW");
8316 3 MYSQL_YYABORT;
8317 }
8318 139 lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED;
8319 139 lex->create_view_mode= enum_view_create_mode::VIEW_ALTER;
8320 }
8321 view_tail
8322 {}
8323 ;
8324
8325 alter_event_stmt:
8326 ALTER definer_opt EVENT_SYM sp_name
8327 {
8328 /*
8329 It is safe to use Lex->spname because
8330 ALTER EVENT xxx RENATE TO yyy DO ALTER EVENT RENAME TO
8331 is not allowed. Lex->spname is used in the case of RENAME TO
8332 If it had to be supported spname had to be added to
8333 Event_parse_data.
8334 */
8335
8336
2/4
✓ Branch 0 taken 237 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 237 times.
474 if (!(Lex->event_parse_data= new (YYTHD->mem_root) Event_parse_data()))
8337 MYSQL_YYABORT;
8338 237 Lex->event_parse_data->identifier= $4;
8339
8340 237 Lex->sql_command= SQLCOM_ALTER_EVENT;
8341 #ifdef WITH_WSREP
8342 237 Lex->stmt_definition_begin= @3.cpp.start;
8343 #endif /* WITH_WSREP */
8344 }
8345 ev_alter_on_schedule_completion
8346 opt_ev_rename_to
8347 opt_ev_status
8348 opt_ev_comment
8349 opt_ev_sql_stmt
8350 {
8351
10/10
✓ Branch 0 taken 147 times.
✓ Branch 1 taken 87 times.
✓ Branch 2 taken 114 times.
✓ Branch 3 taken 33 times.
✓ Branch 4 taken 33 times.
✓ Branch 5 taken 81 times.
✓ Branch 6 taken 5 times.
✓ Branch 7 taken 28 times.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 4 times.
234 if (!($6 || $7 || $8 || $9 || $10))
8352 {
8353
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error();
8354 1 MYSQL_YYABORT;
8355 }
8356 /*
8357 sql_command is set here because some rules in ev_sql_stmt
8358 can overwrite it
8359 */
8360 233 Lex->sql_command= SQLCOM_ALTER_EVENT;
8361 #ifdef WITH_WSREP
8362 233 Lex->stmt_definition_end= const_cast<char*>(YYLIP->get_cpp_ptr());
8363 #endif /* WITH_WSREP */
8364 }
8365 ;
8366
8367 alter_logfile_stmt:
8368 ALTER LOGFILE_SYM GROUP_SYM ident ADD lg_undofile
8369 opt_alter_logfile_group_options
8370 {
8371
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
8372
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (pc == NULL)
8373 MYSQL_YYABORT; /* purecov: inspected */ // OOM
8374
8375
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 if ($7 != NULL)
8376 {
8377
5/10
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 5 times.
5 if (YYTHD->is_error() || contextualize_array(pc, $7))
8378 MYSQL_YYABORT; /* purecov: inspected */
8379 }
8380
8381
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
10 Lex->m_sql_cmd= NEW_PTN Sql_cmd_logfile_group{ALTER_LOGFILE_GROUP,
8382
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
10 $4, pc, $6};
8383
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (!Lex->m_sql_cmd)
8384 MYSQL_YYABORT; /* purecov: inspected */ //OOM
8385
8386 5 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
8387 }
8388
8389 alter_tablespace_stmt:
8390 ALTER TABLESPACE_SYM ident ADD ts_datafile
8391 opt_alter_tablespace_options
8392 {
8393
2/4
✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
✗ Branch 3 not taken.
27 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
8394
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 27 times.
27 if (pc == NULL)
8395 MYSQL_YYABORT; /* purecov: inspected */ // OOM
8396
8397
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 18 times.
27 if ($6 != NULL)
8398 {
8399
5/10
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 9 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 9 times.
9 if (YYTHD->is_error() || contextualize_array(pc, $6))
8400 MYSQL_YYABORT; /* purecov: inspected */
8401 }
8402
8403
2/4
✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
✗ Branch 3 not taken.
27 Lex->m_sql_cmd= NEW_PTN Sql_cmd_alter_tablespace_add_datafile{$3, $5, pc};
8404
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 27 times.
27 if (!Lex->m_sql_cmd)
8405 MYSQL_YYABORT; /* purecov: inspected */ // OOM
8406
8407 27 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
8408 }
8409 | ALTER TABLESPACE_SYM ident DROP ts_datafile
8410 opt_alter_tablespace_options
8411 {
8412
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
6 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
8413
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if (pc == NULL)
8414 MYSQL_YYABORT; /* purecov: inspected */ // OOM
8415
8416
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3 times.
6 if ($6 != NULL)
8417 {
8418
5/10
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 3 times.
3 if (YYTHD->is_error() || contextualize_array(pc, $6))
8419 MYSQL_YYABORT; /* purecov: inspected */
8420 }
8421
8422 6 Lex->m_sql_cmd=
8423
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
6 NEW_PTN Sql_cmd_alter_tablespace_drop_datafile{$3, $5, pc};
8424
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if (!Lex->m_sql_cmd)
8425 MYSQL_YYABORT; /* purecov: inspected */ // OOM
8426
8427 6 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
8428 }
8429 | ALTER TABLESPACE_SYM ident RENAME TO_SYM ident
8430 {
8431
2/4
✓ Branch 0 taken 89 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 89 times.
✗ Branch 3 not taken.
89 Lex->m_sql_cmd= NEW_PTN Sql_cmd_alter_tablespace_rename{$3, $6};
8432
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 89 times.
89 if (!Lex->m_sql_cmd)
8433 MYSQL_YYABORT; // OOM
8434
8435 89 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
8436 }
8437 | ALTER TABLESPACE_SYM ident alter_tablespace_option_list
8438 {
8439
2/4
✓ Branch 0 taken 534 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 534 times.
✗ Branch 3 not taken.
534 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
8440
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 534 times.
534 if (pc == NULL)
8441 MYSQL_YYABORT; // OOM
8442
8443
1/2
✓ Branch 0 taken 534 times.
✗ Branch 1 not taken.
534 if ($4 != NULL)
8444 {
8445
5/10
✓ Branch 0 taken 534 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 534 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 534 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 534 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 534 times.
534 if (YYTHD->is_error() || contextualize_array(pc, $4))
8446 MYSQL_YYABORT;
8447 }
8448
8449 534 Lex->m_sql_cmd=
8450
2/4
✓ Branch 0 taken 534 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 534 times.
✗ Branch 3 not taken.
534 NEW_PTN Sql_cmd_alter_tablespace{$3, pc};
8451
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 534 times.
534 if (!Lex->m_sql_cmd)
8452 MYSQL_YYABORT; // OOM
8453
8454 534 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
8455 }
8456 ;
8457
8458 alter_undo_tablespace_stmt:
8459 ALTER UNDO_SYM TABLESPACE_SYM ident SET_SYM undo_tablespace_state
8460 opt_undo_tablespace_options
8461 {
8462
2/4
✓ Branch 0 taken 544 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 544 times.
✗ Branch 3 not taken.
544 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
8463
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 544 times.
544 if (pc == NULL)
8464 MYSQL_YYABORT; // OOM
8465
8466
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 540 times.
544 if ($7 != NULL)
8467 {
8468
5/10
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 4 times.
4 if (YYTHD->is_error() || contextualize_array(pc, $7))
8469 MYSQL_YYABORT;
8470 }
8471
8472 auto cmd= NEW_PTN Sql_cmd_alter_undo_tablespace{
8473 544 ALTER_UNDO_TABLESPACE, $4,
8474
2/4
✓ Branch 0 taken 544 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 544 times.
✗ Branch 3 not taken.
544 {nullptr, 0}, pc, $6};
8475
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 544 times.
544 if (!cmd)
8476 MYSQL_YYABORT; //OOM
8477 544 Lex->m_sql_cmd= cmd;
8478 544 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
8479 }
8480 ;
8481
8482 alter_server_stmt:
8483 ALTER SERVER_SYM ident_or_text OPTIONS_SYM '(' server_options_list ')'
8484 {
8485 16 LEX *lex= Lex;
8486 16 lex->sql_command= SQLCOM_ALTER_SERVER;
8487 16 lex->server_options.m_server_name= $3;
8488 16 lex->m_sql_cmd=
8489
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 NEW_PTN Sql_cmd_alter_server(&Lex->server_options);
8490 }
8491 ;
8492
8493 alter_user_stmt:
8494 alter_user_command alter_user_list require_clause
8495 connect_options opt_account_lock_password_expire_options
8496 opt_user_attribute
8497 | alter_user_command user_func identified_by_random_password
8498 opt_replace_password opt_retain_current_password
8499 {
8500 $2->first_factor_auth_info = *$3;
8501
8502 if ($4.str != nullptr) {
8503 $2->current_auth = $4;
8504 $2->uses_replace_clause = true;
8505 }
8506 $2->discard_old_password = false;
8507 $2->retain_current_password = $5;
8508 }
8509 | alter_user_command user_func identified_by_password
8510 opt_replace_password opt_retain_current_password
8511 {
8512 168 $2->first_factor_auth_info = *$3;
8513
8514
2/2
✓ Branch 0 taken 83 times.
✓ Branch 1 taken 85 times.
168 if ($4.str != nullptr) {
8515 83 $2->current_auth = $4;
8516 83 $2->uses_replace_clause = true;
8517 }
8518 168 $2->discard_old_password = false;
8519 168 $2->retain_current_password = $5;
8520 }
8521 | alter_user_command user_func DISCARD_SYM OLD_SYM PASSWORD
8522 {
8523 4 $2->discard_old_password = true;
8524 4 $2->retain_current_password = false;
8525 }
8526 | alter_user_command user DEFAULT_SYM ROLE_SYM ALL
8527 {
8528
1/2
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
52 List<LEX_USER> *users= new (YYMEM_ROOT) List<LEX_USER>;
8529
4/8
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 52 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 52 times.
52 if (users == NULL || users->push_back($2))
8530 MYSQL_YYABORT;
8531
1/2
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
52 List<LEX_USER> *role_list= new (YYMEM_ROOT) List<LEX_USER>;
8532 auto *tmp=
8533 52 NEW_PTN PT_alter_user_default_role(Lex->drop_if_exists,
8534 users, role_list,
8535
1/2
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
52 role_enum::ROLE_ALL);
8536
5/10
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 52 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 52 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 52 times.
52 MAKE_CMD(tmp);
8537 }
8538 | alter_user_command user DEFAULT_SYM ROLE_SYM NONE_SYM
8539 {
8540
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 List<LEX_USER> *users= new (YYMEM_ROOT) List<LEX_USER>;
8541
4/8
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 16 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 16 times.
16 if (users == NULL || users->push_back($2))
8542 MYSQL_YYABORT;
8543
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 List<LEX_USER> *role_list= new (YYMEM_ROOT) List<LEX_USER>;
8544 auto *tmp=
8545 16 NEW_PTN PT_alter_user_default_role(Lex->drop_if_exists,
8546 users, role_list,
8547
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 role_enum::ROLE_NONE);
8548
5/10
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 16 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 16 times.
16 MAKE_CMD(tmp);
8549 }
8550 | alter_user_command user DEFAULT_SYM ROLE_SYM role_list
8551 {
8552
1/2
✓ Branch 0 taken 51 times.
✗ Branch 1 not taken.
51 List<LEX_USER> *users= new (YYMEM_ROOT) List<LEX_USER>;
8553
4/8
✓ Branch 0 taken 51 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 51 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 51 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 51 times.
51 if (users == NULL || users->push_back($2))
8554 MYSQL_YYABORT;
8555 auto *tmp=
8556 51 NEW_PTN PT_alter_user_default_role(Lex->drop_if_exists,
8557 51 users, $5,
8558
1/2
✓ Branch 0 taken 51 times.
✗ Branch 1 not taken.
51 role_enum::ROLE_NAME);
8559
5/10
✓ Branch 0 taken 51 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 51 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 51 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 51 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 51 times.
51 MAKE_CMD(tmp);
8560 }
8561 | alter_user_command user opt_user_registration
8562 {
8563 if ($2->mfa_list.push_back($3))
8564 MYSQL_YYABORT; // OOM
8565 LEX *lex=Lex;
8566 lex->users_list.push_front ($2);
8567 }
8568 | alter_user_command user_func opt_user_registration
8569 {
8570 if ($2->mfa_list.push_back($3))
8571 MYSQL_YYABORT; // OOM
8572 }
8573 ;
8574
8575 opt_replace_password:
8576 801 /* empty */ { $$ = LEX_CSTRING{nullptr, 0}; }
8577 297 | REPLACE_SYM TEXT_STRING_password { $$ = to_lex_cstring($2); }
8578 ;
8579
8580 alter_resource_group_stmt:
8581 ALTER RESOURCE_SYM GROUP_SYM ident opt_resource_group_vcpu_list
8582 opt_resource_group_priority opt_resource_group_enable_disable
8583 opt_force
8584 {
8585
1/2
✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
57 $$= NEW_PTN PT_alter_resource_group(to_lex_cstring($4),
8586 38 $5, $6, $7, $8);
8587 }
8588 ;
8589
8590 alter_user_command:
8591 ALTER USER if_exists
8592 {
8593 2718 LEX *lex= Lex;
8594 2718 lex->sql_command= SQLCOM_ALTER_USER;
8595 2718 lex->drop_if_exists= $3;
8596 }
8597 ;
8598
8599 opt_user_attribute:
8600 /* empty */
8601 {
8602 9145 LEX *lex= Lex;
8603 9145 lex->alter_user_attribute =
8604 enum_alter_user_attribute::ALTER_USER_COMMENT_NOT_USED;
8605 }
8606 | ATTRIBUTE_SYM TEXT_STRING_literal
8607 {
8608 29 LEX *lex= Lex;
8609 29 lex->alter_user_attribute =
8610 enum_alter_user_attribute::ALTER_USER_ATTRIBUTE;
8611 29 lex->alter_user_comment_text = $2;
8612 }
8613 | COMMENT_SYM TEXT_STRING_literal
8614 {
8615 35 LEX *lex= Lex;
8616 35 lex->alter_user_attribute =
8617 enum_alter_user_attribute::ALTER_USER_COMMENT;
8618 35 lex->alter_user_comment_text = $2;
8619 }
8620 ;
8621 opt_account_lock_password_expire_options:
8622 /* empty */ {}
8623 | opt_account_lock_password_expire_option_list
8624 ;
8625
8626 opt_account_lock_password_expire_option_list:
8627 opt_account_lock_password_expire_option
8628 | opt_account_lock_password_expire_option_list opt_account_lock_password_expire_option
8629 ;
8630
8631 opt_account_lock_password_expire_option:
8632 ACCOUNT_SYM UNLOCK_SYM
8633 {
8634 429 LEX *lex=Lex;
8635 429 lex->alter_password.update_account_locked_column= true;
8636 429 lex->alter_password.account_locked= false;
8637 }
8638 | ACCOUNT_SYM LOCK_SYM
8639 {
8640 1399 LEX *lex=Lex;
8641 1399 lex->alter_password.update_account_locked_column= true;
8642 1399 lex->alter_password.account_locked= true;
8643 }
8644 | PASSWORD EXPIRE_SYM
8645 {
8646 179 LEX *lex= Lex;
8647 179 lex->alter_password.expire_after_days= 0;
8648 179 lex->alter_password.update_password_expired_column= true;
8649 179 lex->alter_password.update_password_expired_fields= true;
8650 179 lex->alter_password.use_default_password_lifetime= true;
8651 }
8652 | PASSWORD EXPIRE_SYM INTERVAL_SYM real_ulong_num DAY_SYM
8653 {
8654 67 LEX *lex= Lex;
8655
4/4
✓ Branch 0 taken 66 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 59 times.
67 if ($4 == 0 || $4 > UINT_MAX16)
8656 {
8657 char buf[MAX_BIGINT_WIDTH + 1];
8658 8 snprintf(buf, sizeof(buf), "%lu", $4);
8659
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 my_error(ER_WRONG_VALUE, MYF(0), "DAY", buf);
8660 8 MYSQL_YYABORT;
8661 }
8662 59 lex->alter_password.expire_after_days= $4;
8663 59 lex->alter_password.update_password_expired_column= false;
8664 59 lex->alter_password.update_password_expired_fields= true;
8665 59 lex->alter_password.use_default_password_lifetime= false;
8666 }
8667 | PASSWORD EXPIRE_SYM NEVER_SYM
8668 {
8669 84 LEX *lex= Lex;
8670 84 lex->alter_password.expire_after_days= 0;
8671 84 lex->alter_password.update_password_expired_column= false;
8672 84 lex->alter_password.update_password_expired_fields= true;
8673 84 lex->alter_password.use_default_password_lifetime= false;
8674 }
8675 | PASSWORD EXPIRE_SYM DEFAULT_SYM
8676 {
8677 67 LEX *lex= Lex;
8678 67 lex->alter_password.expire_after_days= 0;
8679 67 lex->alter_password.update_password_expired_column= false;
8680 67 Lex->alter_password.update_password_expired_fields= true;
8681 67 lex->alter_password.use_default_password_lifetime= true;
8682 }
8683 | PASSWORD HISTORY_SYM real_ulong_num
8684 {
8685 32 LEX *lex= Lex;
8686 32 lex->alter_password.password_history_length= $3;
8687 32 lex->alter_password.update_password_history= true;
8688 32 lex->alter_password.use_default_password_history= false;
8689 }
8690 | PASSWORD HISTORY_SYM DEFAULT_SYM
8691 {
8692 23 LEX *lex= Lex;
8693 23 lex->alter_password.password_history_length= 0;
8694 23 lex->alter_password.update_password_history= true;
8695 23 lex->alter_password.use_default_password_history= true;
8696 }
8697 | PASSWORD REUSE_SYM INTERVAL_SYM real_ulong_num DAY_SYM
8698 {
8699 11 LEX *lex= Lex;
8700 11 lex->alter_password.password_reuse_interval= $4;
8701 11 lex->alter_password.update_password_reuse_interval= true;
8702 11 lex->alter_password.use_default_password_reuse_interval= false;
8703 }
8704 | PASSWORD REUSE_SYM INTERVAL_SYM DEFAULT_SYM
8705 {
8706 18 LEX *lex= Lex;
8707 18 lex->alter_password.password_reuse_interval= 0;
8708 18 lex->alter_password.update_password_reuse_interval= true;
8709 18 lex->alter_password.use_default_password_reuse_interval= true;
8710 }
8711 | PASSWORD REQUIRE_SYM CURRENT_SYM
8712 {
8713 27 LEX *lex= Lex;
8714 27 lex->alter_password.update_password_require_current=
8715 Lex_acl_attrib_udyn::YES;
8716 }
8717 | PASSWORD REQUIRE_SYM CURRENT_SYM DEFAULT_SYM
8718 {
8719 31 LEX *lex= Lex;
8720 31 lex->alter_password.update_password_require_current=
8721 Lex_acl_attrib_udyn::DEFAULT;
8722 }
8723 | PASSWORD REQUIRE_SYM CURRENT_SYM OPTIONAL_SYM
8724 {
8725 18 LEX *lex= Lex;
8726 18 lex->alter_password.update_password_require_current=
8727 Lex_acl_attrib_udyn::NO;
8728 }
8729 | FAILED_LOGIN_ATTEMPTS_SYM real_ulong_num
8730 {
8731 54 LEX *lex= Lex;
8732
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 53 times.
54 if ($2 > INT_MAX16) {
8733 char buf[MAX_BIGINT_WIDTH + 1];
8734 1 snprintf(buf, sizeof(buf), "%lu", $2);
8735
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_WRONG_VALUE, MYF(0), "FAILED_LOGIN_ATTEMPTS", buf);
8736 1 MYSQL_YYABORT;
8737 }
8738 53 lex->alter_password.update_failed_login_attempts= true;
8739 53 lex->alter_password.failed_login_attempts= $2;
8740 }
8741 | PASSWORD_LOCK_TIME_SYM real_ulong_num
8742 {
8743 52 LEX *lex= Lex;
8744
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 51 times.
52 if ($2 > INT_MAX16) {
8745 char buf[MAX_BIGINT_WIDTH + 1];
8746 1 snprintf(buf, sizeof(buf), "%lu", $2);
8747
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_WRONG_VALUE, MYF(0), "PASSWORD_LOCK_TIME", buf);
8748 1 MYSQL_YYABORT;
8749 }
8750 51 lex->alter_password.update_password_lock_time= true;
8751 51 lex->alter_password.password_lock_time= $2;
8752 }
8753 | PASSWORD_LOCK_TIME_SYM UNBOUNDED_SYM
8754 {
8755 13 LEX *lex= Lex;
8756 13 lex->alter_password.update_password_lock_time= true;
8757 13 lex->alter_password.password_lock_time= -1;
8758 }
8759 ;
8760
8761 connect_options:
8762 /* empty */ {}
8763 | WITH connect_option_list
8764 ;
8765
8766 connect_option_list:
8767 connect_option_list connect_option {}
8768 | connect_option {}
8769 ;
8770
8771 connect_option:
8772 MAX_QUERIES_PER_HOUR ulong_num
8773 {
8774 185 LEX *lex=Lex;
8775 185 lex->mqh.questions=$2;
8776 185 lex->mqh.specified_limits|= USER_RESOURCES::QUERIES_PER_HOUR;
8777 }
8778 | MAX_UPDATES_PER_HOUR ulong_num
8779 {
8780 18 LEX *lex=Lex;
8781 18 lex->mqh.updates=$2;
8782 18 lex->mqh.specified_limits|= USER_RESOURCES::UPDATES_PER_HOUR;
8783 }
8784 | MAX_CONNECTIONS_PER_HOUR ulong_num
8785 {
8786 53 LEX *lex=Lex;
8787 53 lex->mqh.conn_per_hour= $2;
8788 53 lex->mqh.specified_limits|= USER_RESOURCES::CONNECTIONS_PER_HOUR;
8789 }
8790 | MAX_USER_CONNECTIONS_SYM ulong_num
8791 {
8792 168 LEX *lex=Lex;
8793 168 lex->mqh.user_conn= $2;
8794 168 lex->mqh.specified_limits|= USER_RESOURCES::USER_CONNECTIONS;
8795 }
8796 ;
8797
8798 user_func:
8799 USER '(' ')'
8800 {
8801 /* empty LEX_USER means current_user */
8802 LEX_USER *curr_user;
8803
2/4
✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 180 times.
180 if (!(curr_user= LEX_USER::alloc(YYTHD)))
8804 MYSQL_YYABORT;
8805
8806
1/2
✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
180 Lex->users_list.push_back(curr_user);
8807 180 $$= curr_user;
8808 }
8809 ;
8810
8811 ev_alter_on_schedule_completion:
8812 150 /* empty */ { $$= 0;}
8813 76 | ON_SYM SCHEDULE_SYM ev_schedule_time { $$= 1; }
8814 3 | ev_on_completion { $$= 1; }
8815 8 | ON_SYM SCHEDULE_SYM ev_schedule_time ev_on_completion { $$= 1; }
8816 ;
8817
8818 opt_ev_rename_to:
8819 202 /* empty */ { $$= 0;}
8820 | RENAME TO_SYM sp_name
8821 {
8822 /*
8823 Use lex's spname to hold the new name.
8824 The original name is in the Event_parse_data object
8825 */
8826 34 Lex->spname= $3;
8827 34 $$= 1;
8828 }
8829 ;
8830
8831 opt_ev_sql_stmt:
8832 208 /* empty*/ { $$= 0;}
8833 26 | DO_SYM ev_sql_stmt { $$= 1; }
8834 ;
8835
8836 ident_or_empty:
8837 11 /* empty */ { $$.str= 0; $$.length= 0; }
8838 993 | ident { $$= $1; }
8839 ;
8840
8841 opt_alter_table_actions:
8842 opt_alter_command_list
8843 | opt_alter_command_list alter_table_partition_options
8844 {
8845 793 $$= $1;
8846
2/2
✓ Branch 0 taken 759 times.
✓ Branch 1 taken 34 times.
793 if ($$.actions == NULL)
8847 {
8848
2/4
✓ Branch 0 taken 759 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 759 times.
✗ Branch 3 not taken.
759 $$.actions= NEW_PTN Mem_root_array<PT_ddl_table_option *>(YYMEM_ROOT);
8849
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 759 times.
759 if ($$.actions == NULL)
8850 MYSQL_YYABORT; // OOM
8851 }
8852
2/4
✓ Branch 0 taken 793 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 793 times.
793 if ($$.actions->push_back($2))
8853 MYSQL_YYABORT; // OOM
8854 }
8855 ;
8856
8857 standalone_alter_table_action:
8858 standalone_alter_commands
8859 {
8860
1/2
✓ Branch 0 taken 3005 times.
✗ Branch 1 not taken.
3005 $$.flags.init();
8861 3005 $$.action= $1;
8862 }
8863 | alter_commands_modifier_list ',' standalone_alter_commands
8864 {
8865 68 $$.flags= $1;
8866 68 $$.action= $3;
8867 }
8868 ;
8869
8870 alter_table_partition_options:
8871 partition_clause
8872 {
8873
2/4
✓ Branch 0 taken 551 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 551 times.
✗ Branch 3 not taken.
551 $$= NEW_PTN PT_alter_table_partition_by($1);
8874 }
8875 | REMOVE_SYM PARTITIONING_SYM
8876 {
8877
2/4
✓ Branch 0 taken 242 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 242 times.
✗ Branch 3 not taken.
242 $$= NEW_PTN PT_alter_table_remove_partitioning;
8878 }
8879 ;
8880
8881 opt_alter_command_list:
8882 /* empty */
8883 {
8884
1/2
✓ Branch 0 taken 777 times.
✗ Branch 1 not taken.
777 $$.flags.init();
8885 777 $$.actions= NULL;
8886 }
8887 | alter_commands_modifier_list
8888 {
8889 28 $$.flags= $1;
8890 28 $$.actions= NULL;
8891 }
8892 | alter_list
8893 | alter_commands_modifier_list ',' alter_list
8894 {
8895 138 $$.flags= $1;
8896
1/2
✓ Branch 0 taken 138 times.
✗ Branch 1 not taken.
138 $$.flags.merge($3.flags);
8897 138 $$.actions= $3.actions;
8898 }
8899 ;
8900
8901 standalone_alter_commands:
8902 DISCARD_SYM TABLESPACE_SYM
8903 {
8904
2/4
✓ Branch 0 taken 392 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 392 times.
✗ Branch 3 not taken.
392 $$= NEW_PTN PT_alter_table_discard_tablespace;
8905 }
8906 | IMPORT TABLESPACE_SYM
8907 {
8908
2/4
✓ Branch 0 taken 370 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 370 times.
✗ Branch 3 not taken.
370 $$= NEW_PTN PT_alter_table_import_tablespace;
8909 }
8910 /*
8911 This part was added for release 5.1 by Mikael Ronström.
8912 From here we insert a number of commands to manage the partitions of a
8913 partitioned table such as adding partitions, dropping partitions,
8914 reorganising partitions in various manners. In future releases the list
8915 will be longer.
8916 */
8917 | ADD PARTITION_SYM opt_no_write_to_binlog
8918 {
8919
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 $$= NEW_PTN PT_alter_table_add_partition($3);
8920 }
8921 | ADD PARTITION_SYM opt_no_write_to_binlog '(' part_def_list ')'
8922 {
8923
2/4
✓ Branch 0 taken 147 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 147 times.
✗ Branch 3 not taken.
147 $$= NEW_PTN PT_alter_table_add_partition_def_list($3, $5);
8924 }
8925 | ADD PARTITION_SYM opt_no_write_to_binlog PARTITIONS_SYM real_ulong_num
8926 {
8927
2/4
✓ Branch 0 taken 127 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 127 times.
✗ Branch 3 not taken.
127 $$= NEW_PTN PT_alter_table_add_partition_num($3, $5);
8928 }
8929 | DROP PARTITION_SYM ident_string_list
8930 {
8931
2/4
✓ Branch 0 taken 291 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 291 times.
✗ Branch 3 not taken.
291 $$= NEW_PTN PT_alter_table_drop_partition(*$3);
8932 }
8933 | REBUILD_SYM PARTITION_SYM opt_no_write_to_binlog
8934 all_or_alt_part_name_list
8935 {
8936
2/4
✓ Branch 0 taken 155 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 155 times.
✗ Branch 3 not taken.
155 $$= NEW_PTN PT_alter_table_rebuild_partition($3, $4);
8937 }
8938 | OPTIMIZE PARTITION_SYM opt_no_write_to_binlog
8939 all_or_alt_part_name_list
8940 {
8941
2/4
✓ Branch 0 taken 85 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 85 times.
✗ Branch 3 not taken.
85 $$= NEW_PTN PT_alter_table_optimize_partition($3, $4);
8942 }
8943 | ANALYZE_SYM PARTITION_SYM opt_no_write_to_binlog
8944 all_or_alt_part_name_list
8945 {
8946
2/4
✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
✗ Branch 3 not taken.
88 $$= NEW_PTN PT_alter_table_analyze_partition($3, $4);
8947 }
8948 | CHECK_SYM PARTITION_SYM all_or_alt_part_name_list opt_mi_check_types
8949 {
8950
1/2
✓ Branch 0 taken 71 times.
✗ Branch 1 not taken.
142 $$= NEW_PTN PT_alter_table_check_partition($3,
8951
1/2
✓ Branch 0 taken 71 times.
✗ Branch 1 not taken.
142 $4.flags, $4.sql_flags);
8952 }
8953 | REPAIR PARTITION_SYM opt_no_write_to_binlog
8954 all_or_alt_part_name_list
8955 opt_mi_repair_types
8956 {
8957
1/2
✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
164 $$= NEW_PTN PT_alter_table_repair_partition($3, $4,
8958
1/2
✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
164 $5.flags, $5.sql_flags);
8959 }
8960 | COALESCE PARTITION_SYM opt_no_write_to_binlog real_ulong_num
8961 {
8962
2/4
✓ Branch 0 taken 175 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 175 times.
✗ Branch 3 not taken.
175 $$= NEW_PTN PT_alter_table_coalesce_partition($3, $4);
8963 }
8964 | TRUNCATE_SYM PARTITION_SYM all_or_alt_part_name_list
8965 {
8966
2/4
✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 140 times.
✗ Branch 3 not taken.
140 $$= NEW_PTN PT_alter_table_truncate_partition($3);
8967 }
8968 | REORGANIZE_SYM PARTITION_SYM opt_no_write_to_binlog
8969 {
8970
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 $$= NEW_PTN PT_alter_table_reorganize_partition($3);
8971 }
8972 | REORGANIZE_SYM PARTITION_SYM opt_no_write_to_binlog
8973 ident_string_list INTO '(' part_def_list ')'
8974 {
8975
2/4
✓ Branch 0 taken 291 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 291 times.
✗ Branch 3 not taken.
291 $$= NEW_PTN PT_alter_table_reorganize_partition_into($3, *$4, $7);
8976 }
8977 | EXCHANGE_SYM PARTITION_SYM ident
8978 WITH TABLE_SYM table_ident opt_with_validation
8979 {
8980
2/4
✓ Branch 0 taken 333 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 333 times.
✗ Branch 3 not taken.
333 $$= NEW_PTN PT_alter_table_exchange_partition($3, $6, $7);
8981 }
8982 | DISCARD_SYM PARTITION_SYM all_or_alt_part_name_list
8983 TABLESPACE_SYM
8984 {
8985
2/4
✓ Branch 0 taken 107 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 107 times.
✗ Branch 3 not taken.
107 $$= NEW_PTN PT_alter_table_discard_partition_tablespace($3);
8986 }
8987 | IMPORT PARTITION_SYM all_or_alt_part_name_list
8988 TABLESPACE_SYM
8989 {
8990
2/4
✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
77 $$= NEW_PTN PT_alter_table_import_partition_tablespace($3);
8991 }
8992 | SECONDARY_LOAD_SYM
8993 {
8994
2/4
✓ Branch 0 taken 101 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 101 times.
✗ Branch 3 not taken.
101 $$= NEW_PTN PT_alter_table_secondary_load;
8995 }
8996 | SECONDARY_UNLOAD_SYM
8997 {
8998
2/4
✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
✗ Branch 3 not taken.
39 $$= NEW_PTN PT_alter_table_secondary_unload;
8999 }
9000 ;
9001
9002 opt_with_validation:
9003 261 /* empty */ { $$= Alter_info::ALTER_VALIDATION_DEFAULT; }
9004 | with_validation
9005 ;
9006
9007 with_validation:
9008 WITH VALIDATION_SYM
9009 {
9010 42 $$= Alter_info::ALTER_WITH_VALIDATION;
9011 }
9012 | WITHOUT_SYM VALIDATION_SYM
9013 {
9014 66 $$= Alter_info::ALTER_WITHOUT_VALIDATION;
9015 }
9016 ;
9017
9018 all_or_alt_part_name_list:
9019 85 ALL { $$= NULL; }
9020 | ident_string_list
9021 ;
9022
9023 /*
9024 End of management of partition commands
9025 */
9026
9027 alter_list:
9028 alter_list_item
9029 {
9030
1/2
✓ Branch 0 taken 53218 times.
✗ Branch 1 not taken.
53218 $$.flags.init();
9031
2/4
✓ Branch 0 taken 53218 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 53218 times.
✗ Branch 3 not taken.
53218 $$.actions= NEW_PTN Mem_root_array<PT_ddl_table_option *>(YYMEM_ROOT);
9032
4/8
✓ Branch 0 taken 53218 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 53218 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 53218 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 53218 times.
53218 if ($$.actions == NULL || $$.actions->push_back($1))
9033 MYSQL_YYABORT; // OOM
9034 }
9035 | alter_list ',' alter_list_item
9036 {
9037
2/4
✓ Branch 0 taken 36835 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 36835 times.
36835 if ($$.actions->push_back($3))
9038 MYSQL_YYABORT; // OOM
9039 }
9040 | alter_list ',' alter_commands_modifier
9041 {
9042
1/2
✓ Branch 0 taken 4495 times.
✗ Branch 1 not taken.
4495 $$.flags.merge($3);
9043 }
9044 | create_table_options_space_separated
9045 {
9046
1/2
✓ Branch 0 taken 23267 times.
✗ Branch 1 not taken.
23267 $$.flags.init();
9047 23267 $$.actions= $1;
9048 }
9049 | alter_list ',' create_table_options_space_separated
9050 {
9051
3/4
✓ Branch 0 taken 840 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 861 times.
✓ Branch 3 taken 840 times.
1701 for (auto *option : *$3)
9052 {
9053
2/4
✓ Branch 0 taken 861 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 861 times.
861 if ($1.actions->push_back(option))
9054 MYSQL_YYABORT; // OOM
9055 }
9056 }
9057 ;
9058
9059 alter_commands_modifier_list:
9060 alter_commands_modifier
9061 | alter_commands_modifier_list ',' alter_commands_modifier
9062 {
9063 79 $$= $1;
9064
1/2
✓ Branch 0 taken 79 times.
✗ Branch 1 not taken.
79 $$.merge($3);
9065 }
9066 ;
9067
9068 alter_list_item:
9069 ADD opt_column ident field_def opt_references opt_place
9070 {
9071
2/4
✓ Branch 0 taken 32234 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32234 times.
✗ Branch 3 not taken.
32234 $$= NEW_PTN PT_alter_table_add_column($3, $4, $5, $6);
9072 }
9073 | ADD opt_column '(' table_element_list ')'
9074 {
9075
2/4
✓ Branch 0 taken 826 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 826 times.
✗ Branch 3 not taken.
826 $$= NEW_PTN PT_alter_table_add_columns($4);
9076 }
9077 | ADD table_constraint_def
9078 {
9079
2/4
✓ Branch 0 taken 7857 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7857 times.
✗ Branch 3 not taken.
7857 $$= NEW_PTN PT_alter_table_add_constraint($2);
9080 }
9081 | CHANGE opt_column ident ident field_def opt_place
9082 {
9083
2/4
✓ Branch 0 taken 1517 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1517 times.
✗ Branch 3 not taken.
1517 $$= NEW_PTN PT_alter_table_change_column($3, $4, $5, $6);
9084 }
9085 | MODIFY_SYM opt_column ident field_def opt_place
9086 {
9087
2/4
✓ Branch 0 taken 33699 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 33699 times.
✗ Branch 3 not taken.
33699 $$= NEW_PTN PT_alter_table_change_column($3, $4, $5);
9088 }
9089 | DROP opt_column ident opt_restrict
9090 {
9091 // Note: opt_restrict ($4) is ignored!
9092
2/4
✓ Branch 0 taken 2843 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2843 times.
✗ Branch 3 not taken.
2843 $$= NEW_PTN PT_alter_table_drop_column($3.str);
9093 }
9094 | DROP FOREIGN KEY_SYM ident
9095 {
9096
2/4
✓ Branch 0 taken 105 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 105 times.
✗ Branch 3 not taken.
105 $$= NEW_PTN PT_alter_table_drop_foreign_key($4.str);
9097 }
9098 | DROP PRIMARY_SYM KEY_SYM
9099 {
9100
2/4
✓ Branch 0 taken 1952 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1952 times.
✗ Branch 3 not taken.
1952 $$= NEW_PTN PT_alter_table_drop_key(primary_key_name);
9101 }
9102 | DROP key_or_index ident
9103 {
9104
2/4
✓ Branch 0 taken 1377 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1377 times.
✗ Branch 3 not taken.
1377 $$= NEW_PTN PT_alter_table_drop_key($3.str);
9105 }
9106 | DROP CHECK_SYM ident
9107 {
9108
2/4
✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
✗ Branch 3 not taken.
27 $$= NEW_PTN PT_alter_table_drop_check_constraint($3.str);
9109 }
9110 | DROP CONSTRAINT ident
9111 {
9112
2/4
✓ Branch 0 taken 71 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 71 times.
✗ Branch 3 not taken.
71 $$= NEW_PTN PT_alter_table_drop_constraint($3.str);
9113 }
9114 | DISABLE_SYM KEYS
9115 {
9116
2/4
✓ Branch 0 taken 723 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 723 times.
✗ Branch 3 not taken.
723 $$= NEW_PTN PT_alter_table_enable_keys(false);
9117 }
9118 | ENABLE_SYM KEYS
9119 {
9120
2/4
✓ Branch 0 taken 722 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 722 times.
✗ Branch 3 not taken.
722 $$= NEW_PTN PT_alter_table_enable_keys(true);
9121 }
9122 | ALTER opt_column ident SET_SYM DEFAULT_SYM signed_literal_or_null
9123 {
9124
2/4
✓ Branch 0 taken 137 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 137 times.
✗ Branch 3 not taken.
137 $$= NEW_PTN PT_alter_table_set_default($3.str, $6);
9125 }
9126 | ALTER opt_column ident SET_SYM DEFAULT_SYM '(' expr ')'
9127 {
9128
2/4
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
15 $$= NEW_PTN PT_alter_table_set_default($3.str, $7);
9129 }
9130 | ALTER opt_column ident DROP DEFAULT_SYM
9131 {
9132
2/4
✓ Branch 0 taken 76 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 76 times.
✗ Branch 3 not taken.
76 $$= NEW_PTN PT_alter_table_set_default($3.str, NULL);
9133 }
9134
9135 | ALTER opt_column ident SET_SYM visibility
9136 {
9137
2/4
✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 40 times.
✗ Branch 3 not taken.
40 $$= NEW_PTN PT_alter_table_column_visibility($3.str, $5);
9138 }
9139 | ALTER INDEX_SYM ident visibility
9140 {
9141
2/4
✓ Branch 0 taken 127 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 127 times.
✗ Branch 3 not taken.
127 $$= NEW_PTN PT_alter_table_index_visible($3.str, $4);
9142 }
9143 | ALTER CHECK_SYM ident constraint_enforcement
9144 {
9145
2/4
✓ Branch 0 taken 146 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 146 times.
✗ Branch 3 not taken.
146 $$ = NEW_PTN PT_alter_table_enforce_check_constraint($3.str, $4);
9146 }
9147 | ALTER CONSTRAINT ident constraint_enforcement
9148 {
9149
2/4
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
21 $$ = NEW_PTN PT_alter_table_enforce_constraint($3.str, $4);
9150 }
9151 | RENAME opt_to table_ident
9152 {
9153
2/4
✓ Branch 0 taken 2571 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2571 times.
✗ Branch 3 not taken.
2571 $$= NEW_PTN PT_alter_table_rename($3);
9154 }
9155 | RENAME key_or_index ident TO_SYM ident
9156 {
9157
2/4
✓ Branch 0 taken 310 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 310 times.
✗ Branch 3 not taken.
310 $$= NEW_PTN PT_alter_table_rename_key($3.str, $5.str);
9158 }
9159 | RENAME COLUMN_SYM ident TO_SYM ident
9160 {
9161
2/4
✓ Branch 0 taken 183 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 183 times.
✗ Branch 3 not taken.
183 $$= NEW_PTN PT_alter_table_rename_column($3.str, $5.str);
9162 }
9163 | CONVERT_SYM TO_SYM character_set charset_name opt_collate
9164 {
9165
2/4
✓ Branch 0 taken 2286 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2286 times.
✗ Branch 3 not taken.
2286 $$= NEW_PTN PT_alter_table_convert_to_charset($4, $5);
9166 }
9167 | CONVERT_SYM TO_SYM character_set DEFAULT_SYM opt_collate
9168 {
9169
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
14 $$ = NEW_PTN PT_alter_table_convert_to_charset(
9170 YYTHD->variables.collation_database,
9171
3/4
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
14 $5 ? $5 : YYTHD->variables.collation_database);
9172 }
9173 | FORCE_SYM
9174 {
9175
2/4
✓ Branch 0 taken 94 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 94 times.
✗ Branch 3 not taken.
94 $$= NEW_PTN PT_alter_table_force;
9176 }
9177 | ORDER_SYM BY alter_order_list
9178 {
9179
2/4
✓ Branch 0 taken 87 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 87 times.
✗ Branch 3 not taken.
87 $$= NEW_PTN PT_alter_table_order($3);
9180 }
9181 ;
9182
9183 alter_commands_modifier:
9184 alter_algorithm_option
9185 {
9186
1/2
✓ Branch 0 taken 4334 times.
✗ Branch 1 not taken.
4334 $$.init();
9187 4334 $$.algo.set($1);
9188 }
9189 | alter_lock_option
9190 {
9191
1/2
✓ Branch 0 taken 438 times.
✗ Branch 1 not taken.
438 $$.init();
9192 438 $$.lock.set($1);
9193 }
9194 | with_validation
9195 {
9196
1/2
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
36 $$.init();
9197 36 $$.validation.set($1);
9198 }
9199 ;
9200
9201 opt_index_lock_and_algorithm:
9202
1/2
✓ Branch 0 taken 10188 times.
✗ Branch 1 not taken.
10188 /* Empty. */ { $$.init(); }
9203 | alter_lock_option
9204 {
9205
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 $$.init();
9206 4 $$.lock.set($1);
9207 }
9208 | alter_algorithm_option
9209 {
9210
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 $$.init();
9211 5 $$.algo.set($1);
9212 }
9213 | alter_lock_option alter_algorithm_option
9214 {
9215
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$.init();
9216 2 $$.lock.set($1);
9217 2 $$.algo.set($2);
9218 }
9219 | alter_algorithm_option alter_lock_option
9220 {
9221
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$.init();
9222 2 $$.algo.set($1);
9223 2 $$.lock.set($2);
9224 }
9225 ;
9226
9227 alter_algorithm_option:
9228 4343 ALGORITHM_SYM opt_equal alter_algorithm_option_value { $$= $3; }
9229 ;
9230
9231 alter_algorithm_option_value:
9232 DEFAULT_SYM
9233 {
9234 67 $$= Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT;
9235 }
9236 | ident
9237 {
9238
3/4
✓ Branch 0 taken 4278 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1327 times.
✓ Branch 3 taken 2951 times.
4278 if (is_identifier($1, "INPLACE"))
9239 1327 $$= Alter_info::ALTER_TABLE_ALGORITHM_INPLACE;
9240
3/4
✓ Branch 0 taken 2951 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1309 times.
✓ Branch 3 taken 1642 times.
2951 else if (is_identifier($1, "INSTANT"))
9241 1309 $$= Alter_info::ALTER_TABLE_ALGORITHM_INSTANT;
9242
3/4
✓ Branch 0 taken 1642 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1640 times.
✓ Branch 3 taken 2 times.
1642 else if (is_identifier($1, "COPY"))
9243 1640 $$= Alter_info::ALTER_TABLE_ALGORITHM_COPY;
9244 else
9245 {
9246
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_UNKNOWN_ALTER_ALGORITHM, MYF(0), $1.str);
9247 2 MYSQL_YYABORT;
9248 }
9249 }
9250 ;
9251
9252 alter_lock_option:
9253 446 LOCK_SYM opt_equal alter_lock_option_value { $$= $3; }
9254 ;
9255
9256 alter_lock_option_value:
9257 DEFAULT_SYM
9258 {
9259 24 $$= Alter_info::ALTER_TABLE_LOCK_DEFAULT;
9260 }
9261 | ident
9262 {
9263
3/4
✓ Branch 0 taken 424 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 224 times.
424 if (is_identifier($1, "NONE"))
9264 200 $$= Alter_info::ALTER_TABLE_LOCK_NONE;
9265
3/4
✓ Branch 0 taken 224 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 149 times.
✓ Branch 3 taken 75 times.
224 else if (is_identifier($1, "SHARED"))
9266 149 $$= Alter_info::ALTER_TABLE_LOCK_SHARED;
9267
3/4
✓ Branch 0 taken 75 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73 times.
✓ Branch 3 taken 2 times.
75 else if (is_identifier($1, "EXCLUSIVE"))
9268 73 $$= Alter_info::ALTER_TABLE_LOCK_EXCLUSIVE;
9269 else
9270 {
9271
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_UNKNOWN_ALTER_LOCK, MYF(0), $1.str);
9272 2 MYSQL_YYABORT;
9273 }
9274 }
9275 ;
9276
9277 opt_column:
9278 /* empty */
9279 | COLUMN_SYM
9280 ;
9281
9282 opt_ignore:
9283 2751263 /* empty */ { $$= false; }
9284 255062 | IGNORE_SYM { $$= true; }
9285 ;
9286
9287 opt_restrict:
9288 174613 /* empty */ { $$= DROP_DEFAULT; }
9289 15 | RESTRICT { $$= DROP_RESTRICT; }
9290 15 | CASCADE { $$= DROP_CASCADE; }
9291 ;
9292
9293 opt_place:
9294 52306 /* empty */ { $$= NULL; }
9295 13364 | AFTER_SYM ident { $$= $2.str; }
9296 1780 | FIRST_SYM { $$= first_keyword; }
9297 ;
9298
9299 opt_to:
9300 /* empty */ {}
9301 | TO_SYM {}
9302 | EQ {}
9303 | AS {}
9304 ;
9305
9306 group_replication:
9307 group_replication_start opt_group_replication_start_options
9308 | STOP_SYM GROUP_REPLICATION
9309 {
9310 2053 LEX *lex = Lex;
9311 2053 lex->sql_command = SQLCOM_STOP_GROUP_REPLICATION;
9312 }
9313 ;
9314
9315 group_replication_start:
9316 START_SYM GROUP_REPLICATION
9317 {
9318 2231 LEX *lex = Lex;
9319
1/2
✓ Branch 0 taken 2231 times.
✗ Branch 1 not taken.
2231 lex->slave_connection.reset();
9320 2231 lex->sql_command = SQLCOM_START_GROUP_REPLICATION;
9321 }
9322 ;
9323
9324 opt_group_replication_start_options:
9325 /* empty */
9326 | group_replication_start_options
9327 ;
9328
9329 group_replication_start_options:
9330 group_replication_start_option
9331 | group_replication_start_options ',' group_replication_start_option
9332 ;
9333
9334 group_replication_start_option:
9335 group_replication_user
9336 | group_replication_password
9337 | group_replication_plugin_auth
9338 ;
9339
9340 group_replication_user:
9341 USER EQ TEXT_STRING_sys_nonewline
9342 {
9343 32 Lex->slave_connection.user = $3.str;
9344
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 30 times.
32 if ($3.length == 0)
9345 {
9346
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_GROUP_REPLICATION_USER_EMPTY_MSG, MYF(0));
9347 2 MYSQL_YYABORT;
9348 }
9349 }
9350 ;
9351
9352 group_replication_password:
9353 PASSWORD EQ TEXT_STRING_sys_nonewline
9354 {
9355 28 Lex->slave_connection.password = $3.str;
9356 28 Lex->contains_plaintext_password = true;
9357
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 27 times.
28 if ($3.length > 32)
9358 {
9359
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_GROUP_REPLICATION_PASSWORD_LENGTH, MYF(0));
9360 1 MYSQL_YYABORT;
9361 }
9362 }
9363 ;
9364
9365 group_replication_plugin_auth:
9366 DEFAULT_AUTH_SYM EQ TEXT_STRING_sys_nonewline
9367 {
9368 13 Lex->slave_connection.plugin_auth= $3.str;
9369 }
9370 ;
9371
9372 replica:
9373 131373 SLAVE { Lex->set_replication_deprecated_syntax_used(); }
9374 | REPLICA_SYM
9375 ;
9376
9377 stop_replica_stmt:
9378 STOP_SYM replica opt_replica_thread_option_list opt_channel
9379 {
9380 5891 LEX *lex=Lex;
9381 5891 lex->sql_command = SQLCOM_SLAVE_STOP;
9382 5891 lex->type = 0;
9383 5891 lex->slave_thd_opt= $3;
9384
2/2
✓ Branch 0 taken 545 times.
✓ Branch 1 taken 5346 times.
5891 if (lex->is_replication_deprecated_syntax_used())
9385
1/2
✓ Branch 0 taken 545 times.
✗ Branch 1 not taken.
545 push_deprecated_warn(YYTHD, "STOP SLAVE", "STOP REPLICA");
9386
2/4
✓ Branch 0 taken 5891 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5891 times.
5891 if (lex->set_channel_name($4))
9387 MYSQL_YYABORT; // OOM
9388 }
9389 ;
9390
9391 start_replica_stmt:
9392 START_SYM replica opt_replica_thread_option_list
9393 {
9394 7065 LEX *lex=Lex;
9395 /* Clean previous replica connection values */
9396
1/2
✓ Branch 0 taken 7065 times.
✗ Branch 1 not taken.
7065 lex->slave_connection.reset();
9397 7065 lex->sql_command = SQLCOM_SLAVE_START;
9398 7065 lex->type = 0;
9399 /* We'll use mi structure for UNTIL options */
9400
1/2
✓ Branch 0 taken 7065 times.
✗ Branch 1 not taken.
7065 lex->mi.set_unspecified();
9401 7065 lex->slave_thd_opt= $3;
9402
2/2
✓ Branch 0 taken 1198 times.
✓ Branch 1 taken 5867 times.
7065 if (lex->is_replication_deprecated_syntax_used())
9403
1/2
✓ Branch 0 taken 1198 times.
✗ Branch 1 not taken.
1198 push_deprecated_warn(YYTHD, "START SLAVE", "START REPLICA");
9404 }
9405 opt_replica_until
9406 opt_user_option opt_password_option
9407 opt_default_auth_option opt_plugin_dir_option
9408 {
9409 /*
9410 It is not possible to set user's information when
9411 one is trying to start the SQL Thread.
9412 */
9413
2/2
✓ Branch 0 taken 1082 times.
✓ Branch 1 taken 5968 times.
7050 if ((Lex->slave_thd_opt & SLAVE_SQL) == SLAVE_SQL &&
9414
2/2
✓ Branch 0 taken 1051 times.
✓ Branch 1 taken 31 times.
1082 (Lex->slave_thd_opt & SLAVE_IO) != SLAVE_IO &&
9415
2/2
✓ Branch 0 taken 1042 times.
✓ Branch 1 taken 9 times.
1051 (Lex->slave_connection.user ||
9416
1/2
✓ Branch 0 taken 1042 times.
✗ Branch 1 not taken.
1042 Lex->slave_connection.password ||
9417
1/2
✓ Branch 0 taken 1042 times.
✗ Branch 1 not taken.
1042 Lex->slave_connection.plugin_auth ||
9418
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1042 times.
1042 Lex->slave_connection.plugin_dir))
9419 {
9420
1/2
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
9 my_error(ER_SQLTHREAD_WITH_SECURE_SLAVE, MYF(0));
9421 9 MYSQL_YYABORT;
9422 }
9423 }
9424 opt_channel
9425 {
9426
2/4
✓ Branch 0 taken 7041 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7041 times.
7041 if (Lex->set_channel_name($11))
9427 MYSQL_YYABORT; // OOM
9428 }
9429 ;
9430
9431 start:
9432 START_SYM TRANSACTION_SYM opt_start_transaction_option_list
9433 {
9434 4679 LEX *lex= Lex;
9435 4679 lex->sql_command= SQLCOM_BEGIN;
9436 /* READ ONLY and READ WRITE are mutually exclusive. */
9437
2/2
✓ Branch 0 taken 13 times.
✓ Branch 1 taken 4666 times.
4679 if (($3 & MYSQL_START_TRANS_OPT_READ_WRITE) &&
9438
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 11 times.
13 ($3 & MYSQL_START_TRANS_OPT_READ_ONLY))
9439 {
9440
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 YYTHD->syntax_error();
9441 2 MYSQL_YYABORT;
9442 }
9443 4677 lex->start_transaction_opt= $3;
9444 }
9445 ;
9446
9447 opt_start_transaction_option_list:
9448 /* empty */
9449 {
9450 4555 $$= 0;
9451 }
9452 | start_transaction_option_list
9453 {
9454 124 $$= $1;
9455 }
9456 ;
9457
9458 start_transaction_option_list:
9459 start_transaction_option
9460 {
9461 124 $$= $1;
9462 }
9463 | start_transaction_option_list ',' start_transaction_option
9464 {
9465 9 $$= $1 | $3;
9466 }
9467 ;
9468
9469 start_transaction_option:
9470 WITH CONSISTENT_SYM SNAPSHOT_SYM
9471 {
9472 65 $$= MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT;
9473 }
9474 | WITH CONSISTENT_SYM SNAPSHOT_SYM FROM SESSION_SYM expr
9475 {
9476
7/14
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 26 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 26 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 26 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 26 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 26 times.
26 ITEMIZE($6, &$6);
9477
9478 26 $$= MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT;
9479 26 Lex->donor_transaction_id= $6;
9480 }
9481 | READ_SYM ONLY_SYM
9482 {
9483 29 $$= MYSQL_START_TRANS_OPT_READ_ONLY;
9484 }
9485 | READ_SYM WRITE_SYM
9486 {
9487 13 $$= MYSQL_START_TRANS_OPT_READ_WRITE;
9488 }
9489 ;
9490
9491 opt_user_option:
9492 {
9493 /* empty */
9494 }
9495 | USER EQ TEXT_STRING_sys
9496 {
9497 123 Lex->slave_connection.user= $3.str;
9498 }
9499 ;
9500
9501 opt_password_option:
9502 {
9503 /* empty */
9504 }
9505 | PASSWORD EQ TEXT_STRING_sys
9506 {
9507 99 Lex->slave_connection.password= $3.str;
9508 99 Lex->contains_plaintext_password= true;
9509 }
9510
9511 opt_default_auth_option:
9512 {
9513 /* empty */
9514 }
9515 | DEFAULT_AUTH_SYM EQ TEXT_STRING_sys
9516 {
9517 54 Lex->slave_connection.plugin_auth= $3.str;
9518 }
9519 ;
9520
9521 opt_plugin_dir_option:
9522 {
9523 /* empty */
9524 }
9525 | PLUGIN_DIR_SYM EQ TEXT_STRING_sys
9526 {
9527 45 Lex->slave_connection.plugin_dir= $3.str;
9528 }
9529 ;
9530
9531 opt_replica_thread_option_list:
9532 /* empty */
9533 {
9534 9869 $$= 0;
9535 }
9536 | replica_thread_option_list
9537 {
9538 3087 $$= $1;
9539 }
9540 ;
9541
9542 replica_thread_option_list:
9543 replica_thread_option
9544 {
9545 3087 $$= $1;
9546 }
9547 | replica_thread_option_list ',' replica_thread_option
9548 {
9549 31 $$= $1 | $3;
9550 }
9551 ;
9552
9553 replica_thread_option:
9554 SQL_THREAD
9555 {
9556 1800 $$= SLAVE_SQL;
9557 }
9558 | RELAY_THREAD
9559 {
9560 1318 $$= SLAVE_IO;
9561 }
9562 ;
9563
9564 opt_replica_until:
9565 /*empty*/
9566 {
9567 6916 LEX *lex= Lex;
9568 6916 lex->mi.slave_until= false;
9569 }
9570 | UNTIL_SYM replica_until
9571 {
9572 149 LEX *lex=Lex;
9573
4/4
✓ Branch 0 taken 80 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 77 times.
149 if (((lex->mi.log_file_name || lex->mi.pos) &&
9574
2/2
✓ Branch 0 taken 66 times.
✓ Branch 1 taken 6 times.
72 lex->mi.gtid) ||
9575
4/4
✓ Branch 0 taken 119 times.
✓ Branch 1 taken 24 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 116 times.
143 ((lex->mi.relay_log_name || lex->mi.relay_log_pos) &&
9576
1/2
✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
27 lex->mi.gtid) ||
9577
4/4
✓ Branch 0 taken 63 times.
✓ Branch 1 taken 80 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 60 times.
143 !((lex->mi.log_file_name && lex->mi.pos) ||
9578
4/4
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 59 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 18 times.
83 (lex->mi.relay_log_name && lex->mi.relay_log_pos) ||
9579
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 35 times.
65 lex->mi.gtid ||
9580
2/2
✓ Branch 0 taken 21 times.
✓ Branch 1 taken 9 times.
30 lex->mi.until_after_gaps) ||
9581 /* SQL_AFTER_MTS_GAPS is meaningless in combination */
9582 /* with any other coordinates related options */
9583
5/6
✓ Branch 0 taken 74 times.
✓ Branch 1 taken 60 times.
✓ Branch 2 taken 74 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 56 times.
✓ Branch 5 taken 18 times.
134 ((lex->mi.log_file_name || lex->mi.pos || lex->mi.relay_log_name
9584
3/4
✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35 times.
✓ Branch 3 taken 21 times.
56 || lex->mi.relay_log_pos || lex->mi.gtid)
9585
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 113 times.
113 && lex->mi.until_after_gaps))
9586 {
9587
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
15 my_error(ER_BAD_SLAVE_UNTIL_COND, MYF(0));
9588 15 MYSQL_YYABORT;
9589 }
9590 134 lex->mi.slave_until= true;
9591 }
9592 ;
9593
9594 replica_until:
9595 source_file_def
9596 | replica_until ',' source_file_def
9597 | SQL_BEFORE_GTIDS EQ TEXT_STRING_sys
9598 {
9599 36 Lex->mi.gtid= $3.str;
9600 36 Lex->mi.gtid_until_condition= LEX_MASTER_INFO::UNTIL_SQL_BEFORE_GTIDS;
9601 }
9602 | SQL_AFTER_GTIDS EQ TEXT_STRING_sys
9603 {
9604 5 Lex->mi.gtid= $3.str;
9605 5 Lex->mi.gtid_until_condition= LEX_MASTER_INFO::UNTIL_SQL_AFTER_GTIDS;
9606 }
9607 | SQL_AFTER_MTS_GAPS
9608 {
9609 21 Lex->mi.until_after_gaps= true;
9610 }
9611 ;
9612
9613 checksum:
9614 CHECKSUM_SYM table_or_tables table_list opt_checksum_type
9615 {
9616 25727 LEX *lex=Lex;
9617 25727 lex->sql_command = SQLCOM_CHECKSUM;
9618 /* Will be overriden during execution. */
9619 25727 YYPS->m_lock_type= TL_UNLOCK;
9620
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 25727 times.
51454 if (Select->add_tables(YYTHD, $3, TL_OPTION_UPDATING,
9621
1/2
✓ Branch 0 taken 25727 times.
✗ Branch 1 not taken.
25727 YYPS->m_lock_type, YYPS->m_mdl_type))
9622 MYSQL_YYABORT;
9623 25727 Lex->check_opt.flags= $4;
9624 }
9625 ;
9626
9627 opt_checksum_type:
9628 25058 /* empty */ { $$= 0; }
9629 1 | QUICK { $$= T_QUICK; }
9630 668 | EXTENDED_SYM { $$= T_EXTEND; }
9631 ;
9632
9633 repair_table_stmt:
9634 REPAIR opt_no_write_to_binlog table_or_tables
9635 table_list opt_mi_repair_types
9636 {
9637
1/2
✓ Branch 0 taken 813 times.
✗ Branch 1 not taken.
1626 $$= NEW_PTN PT_repair_table_stmt(YYMEM_ROOT, $2, $4,
9638
1/2
✓ Branch 0 taken 813 times.
✗ Branch 1 not taken.
1626 $5.flags, $5.sql_flags);
9639 }
9640 ;
9641
9642 opt_mi_repair_types:
9643 271 /* empty */ { $$.flags = T_MEDIUM; $$.sql_flags= 0; }
9644 | mi_repair_types
9645 ;
9646
9647 mi_repair_types:
9648 mi_repair_type
9649 | mi_repair_types mi_repair_type
9650 {
9651 $$.flags= $1.flags | $2.flags;
9652 $$.sql_flags= $1.sql_flags | $2.sql_flags;
9653 }
9654 ;
9655
9656 mi_repair_type:
9657 9 QUICK { $$.flags= T_QUICK; $$.sql_flags= 0; }
9658 599 | EXTENDED_SYM { $$.flags= T_EXTEND; $$.sql_flags= 0; }
9659 16 | USE_FRM { $$.flags= 0; $$.sql_flags= TT_USEFRM; }
9660 ;
9661
9662 analyze_table_stmt:
9663 ANALYZE_SYM opt_no_write_to_binlog table_or_tables table_list
9664 opt_histogram
9665 {
9666
1/2
✓ Branch 0 taken 7415 times.
✗ Branch 1 not taken.
14830 $$= NEW_PTN PT_analyze_table_stmt(YYMEM_ROOT, $1, $2, $4,
9667 $5.command, $5.num_buckets,
9668
1/2
✓ Branch 0 taken 7415 times.
✗ Branch 1 not taken.
14830 $5.columns);
9669 }
9670 ;
9671
9672 opt_num_buckets:
9673 9 /* empty */ { $$= DEFAULT_NUMBER_OF_HISTOGRAM_BUCKETS; }
9674 | WITH NUM BUCKETS_SYM
9675 {
9676 int error;
9677
1/2
✓ Branch 0 taken 220 times.
✗ Branch 1 not taken.
220 longlong num= my_strtoll10($2.str, nullptr, &error);
9678
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 220 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
222 MYSQL_YYABORT_UNLESS(error <= 0);
9679
9680
4/4
✓ Branch 0 taken 219 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 218 times.
220 if (num < 1 || num > MAX_NUMBER_OF_HISTOGRAM_BUCKETS)
9681 {
9682
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_DATA_OUT_OF_RANGE, MYF(0), "Number of buckets",
9683 "ANALYZE TABLE");
9684 2 MYSQL_YYABORT;
9685 }
9686
9687 218 $$= num;
9688 }
9689 ;
9690
9691 opt_histogram:
9692 /* empty */
9693 {
9694 7171 $$.command= Sql_cmd_analyze_table::Histogram_command::NONE;
9695 7171 $$.columns= nullptr;
9696 7171 $$.num_buckets= 0;
9697 }
9698 | UPDATE_SYM HISTOGRAM_SYM ON_SYM ident_string_list opt_num_buckets
9699 {
9700 227 $$.command=
9701 Sql_cmd_analyze_table::Histogram_command::UPDATE_HISTOGRAM;
9702 227 $$.columns= $4;
9703 227 $$.num_buckets= $5;
9704 }
9705 | DROP HISTOGRAM_SYM ON_SYM ident_string_list
9706 {
9707 17 $$.command=
9708 Sql_cmd_analyze_table::Histogram_command::DROP_HISTOGRAM;
9709 17 $$.columns= $4;
9710 17 $$.num_buckets= 0;
9711 }
9712 ;
9713
9714 binlog_base64_event:
9715 BINLOG_SYM TEXT_STRING_sys
9716 {
9717 3705 Lex->sql_command = SQLCOM_BINLOG_BASE64_EVENT;
9718 3705 Lex->binlog_stmt_arg= $2;
9719 }
9720 ;
9721
9722 check_table_stmt:
9723 CHECK_SYM table_or_tables table_list opt_mi_check_types
9724 {
9725
1/2
✓ Branch 0 taken 2991 times.
✗ Branch 1 not taken.
5982 $$= NEW_PTN PT_check_table_stmt(YYMEM_ROOT, $1, $3,
9726
1/2
✓ Branch 0 taken 2991 times.
✗ Branch 1 not taken.
5982 $4.flags, $4.sql_flags);
9727 }
9728 ;
9729
9730 opt_mi_check_types:
9731 1755 /* empty */ { $$.flags = T_MEDIUM; $$.sql_flags= 0; }
9732 | mi_check_types
9733 ;
9734
9735 mi_check_types:
9736 mi_check_type
9737 | mi_check_type mi_check_types
9738 {
9739 $$.flags= $1.flags | $2.flags;
9740 $$.sql_flags= $1.sql_flags | $2.sql_flags;
9741 }
9742 ;
9743
9744 mi_check_type:
9745 QUICK
9746 { $$.flags= T_QUICK; $$.sql_flags= 0; }
9747 | FAST_SYM
9748 2 { $$.flags= T_FAST; $$.sql_flags= 0; }
9749 | MEDIUM_SYM
9750 1 { $$.flags= T_MEDIUM; $$.sql_flags= 0; }
9751 | EXTENDED_SYM
9752 806 { $$.flags= T_EXTEND; $$.sql_flags= 0; }
9753 | CHANGED
9754 2 { $$.flags= T_CHECK_ONLY_CHANGED; $$.sql_flags= 0; }
9755 | FOR_SYM UPGRADE_SYM
9756 496 { $$.flags= 0; $$.sql_flags= TT_FOR_UPGRADE; }
9757 ;
9758
9759 optimize_table_stmt:
9760 OPTIMIZE opt_no_write_to_binlog table_or_tables table_list
9761 {
9762
2/4
✓ Branch 0 taken 2760 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2760 times.
✗ Branch 3 not taken.
2760 $$= NEW_PTN PT_optimize_table_stmt(YYMEM_ROOT, $1, $2, $4);
9763 }
9764 ;
9765
9766 opt_no_write_to_binlog:
9767 33797 /* empty */ { $$= 0; }
9768 488 | NO_WRITE_TO_BINLOG { $$= 1; }
9769 95 | LOCAL_SYM { $$= 1; }
9770 ;
9771
9772 rename:
9773 RENAME table_or_tables
9774 {
9775 10831 Lex->sql_command= SQLCOM_RENAME_TABLE;
9776 }
9777 table_to_table_list
9778 {}
9779 | RENAME USER rename_list
9780 {
9781 527 Lex->sql_command = SQLCOM_RENAME_USER;
9782 }
9783 ;
9784
9785 rename_list:
9786 user TO_SYM user
9787 {
9788
5/10
✓ Branch 0 taken 527 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 527 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 527 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 527 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 527 times.
527 if (Lex->users_list.push_back($1) || Lex->users_list.push_back($3))
9789 MYSQL_YYABORT;
9790 }
9791 | rename_list ',' user TO_SYM user
9792 {
9793
5/10
✓ Branch 0 taken 55 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 55 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 55 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 55 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 55 times.
55 if (Lex->users_list.push_back($3) || Lex->users_list.push_back($5))
9794 MYSQL_YYABORT;
9795 }
9796 ;
9797
9798 table_to_table_list:
9799 table_to_table
9800 | table_to_table_list ',' table_to_table
9801 ;
9802
9803 table_to_table:
9804 table_ident TO_SYM table_ident
9805 {
9806 19302 LEX *lex=Lex;
9807 19302 Query_block *sl= Select;
9808
1/2
✓ Branch 0 taken 19302 times.
✗ Branch 1 not taken.
19302 if (!sl->add_table_to_list(lex->thd, $1,NULL,TL_OPTION_UPDATING,
9809
4/4
✓ Branch 0 taken 19289 times.
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 23 times.
✓ Branch 3 taken 19279 times.
38591 TL_IGNORE, MDL_EXCLUSIVE) ||
9810
3/4
✓ Branch 0 taken 19289 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 19279 times.
19289 !sl->add_table_to_list(lex->thd, $3,NULL,TL_OPTION_UPDATING,
9811 TL_IGNORE, MDL_EXCLUSIVE))
9812 23 MYSQL_YYABORT;
9813 }
9814 ;
9815
9816 keycache_stmt:
9817 CACHE_SYM INDEX_SYM keycache_list IN_SYM key_cache_name
9818 {
9819
2/4
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
25 $$= NEW_PTN PT_cache_index_stmt(YYMEM_ROOT, $3, $5);
9820 }
9821 | CACHE_SYM INDEX_SYM table_ident adm_partition opt_cache_key_list
9822 IN_SYM key_cache_name
9823 {
9824
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
2 $$= NEW_PTN PT_cache_index_partitions_stmt(YYMEM_ROOT,
9825
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
3 $3, $4, $5, $7);
9826 }
9827 ;
9828
9829 keycache_list:
9830 assign_to_keycache
9831 {
9832
2/4
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
25 $$= NEW_PTN Mem_root_array<PT_assign_to_keycache *>(YYMEM_ROOT);
9833
4/8
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 25 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 25 times.
25 if ($$ == NULL || $$->push_back($1))
9834 MYSQL_YYABORT; // OOM
9835 }
9836 | keycache_list ',' assign_to_keycache
9837 {
9838 1 $$= $1;
9839
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if ($$->push_back($3))
9840 MYSQL_YYABORT; // OOM
9841 }
9842 ;
9843
9844 assign_to_keycache:
9845 table_ident opt_cache_key_list
9846 {
9847
2/4
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
✗ Branch 3 not taken.
26 $$= NEW_PTN PT_assign_to_keycache($1, $2);
9848 }
9849 ;
9850
9851 key_cache_name:
9852 23 ident { $$= to_lex_cstring($1); }
9853 3 | DEFAULT_SYM { $$ = default_key_cache_base; }
9854 ;
9855
9856 preload_stmt:
9857 LOAD INDEX_SYM INTO CACHE_SYM
9858 table_ident adm_partition opt_cache_key_list opt_ignore_leaves
9859 {
9860
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 $$= NEW_PTN PT_load_index_partitions_stmt(YYMEM_ROOT, $5,$6, $7, $8);
9861 }
9862 | LOAD INDEX_SYM INTO CACHE_SYM preload_list
9863 {
9864
2/4
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
✗ Branch 3 not taken.
28 $$= NEW_PTN PT_load_index_stmt(YYMEM_ROOT, $1, $5);
9865 }
9866 ;
9867
9868 preload_list:
9869 preload_keys
9870 {
9871
2/4
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
✗ Branch 3 not taken.
28 $$= NEW_PTN Mem_root_array<PT_preload_keys *>(YYMEM_ROOT);
9872
2/4
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 28 times.
28 if ($$->push_back($1))
9873 MYSQL_YYABORT; // OOM
9874 }
9875 | preload_list ',' preload_keys
9876 {
9877 9 $$= $1;
9878
4/8
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 9 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 9 times.
9 if ($$ == NULL || $$->push_back($3))
9879 MYSQL_YYABORT; // OOM
9880 }
9881 ;
9882
9883 preload_keys:
9884 table_ident opt_cache_key_list opt_ignore_leaves
9885 {
9886
2/4
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
✗ Branch 3 not taken.
37 $$= NEW_PTN PT_preload_keys($1, $2, $3);
9887 }
9888 ;
9889
9890 adm_partition:
9891 PARTITION_SYM '(' all_or_alt_part_name_list ')'
9892 {
9893
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 $$= NEW_PTN PT_adm_partition($3);
9894 }
9895 ;
9896
9897 opt_cache_key_list:
9898 55 /* empty */ { $$= NULL; }
9899 | key_or_index '(' opt_key_usage_list ')'
9900 {
9901
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
✓ Branch 2 taken 11 times.
✗ Branch 3 not taken.
11 init_index_hints($3, INDEX_HINT_USE,
9902 old_mode ? INDEX_HINT_MASK_JOIN
9903 : INDEX_HINT_MASK_ALL);
9904 11 $$= $3;
9905 }
9906 ;
9907
9908 opt_ignore_leaves:
9909 25 /* empty */ { $$= false; }
9910 14 | IGNORE_SYM LEAVES { $$= true; }
9911 ;
9912
9913 select_stmt:
9914 query_expression
9915 {
9916
1/2
✓ Branch 0 taken 8895876 times.
✗ Branch 1 not taken.
8895874 $$ = NEW_PTN PT_select_stmt($1);
9917 }
9918 | query_expression locking_clause_list
9919 {
9920
3/6
✓ Branch 0 taken 1356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1356 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1356 times.
✗ Branch 5 not taken.
4068 $$ = NEW_PTN PT_select_stmt(NEW_PTN PT_locking($1, $2),
9921 2712 nullptr, true);
9922 }
9923 | query_expression_parens
9924 {
9925
1/2
✓ Branch 0 taken 110 times.
✗ Branch 1 not taken.
110 $$ = NEW_PTN PT_select_stmt($1);
9926 }
9927 | select_stmt_with_into
9928 ;
9929
9930 /*
9931 MySQL has a syntax extension that allows into clauses in any one of two
9932 places. They may appear either before the from clause or at the end. All in
9933 a top-level select statement. This extends the standard syntax in two
9934 ways. First, we don't have the restriction that the result can contain only
9935 one row: the into clause might be INTO OUTFILE/DUMPFILE in which case any
9936 number of rows is allowed. Hence MySQL does not have any special case for
9937 the standard's <select statement: single row>. Secondly, and this has more
9938 severe implications for the parser, it makes the grammar ambiguous, because
9939 in a from-clause-less select statement with an into clause, it is not clear
9940 whether the into clause is the leading or the trailing one.
9941
9942 While it's possible to write an unambiguous grammar, it would force us to
9943 duplicate the entire <select statement> syntax all the way down to the <into
9944 clause>. So instead we solve it by writing an ambiguous grammar and use
9945 precedence rules to sort out the shift/reduce conflict.
9946
9947 The problem is when the parser has seen SELECT <select list>, and sees an
9948 INTO token. It can now either shift it or reduce what it has to a table-less
9949 query expression. If it shifts the token, it will accept seeing a FROM token
9950 next and hence the INTO will be interpreted as the leading INTO. If it
9951 reduces what it has seen to a table-less select, however, it will interpret
9952 INTO as the trailing into. But what if the next token is FROM? Obviously,
9953 we want to always shift INTO. We do this by two precedence declarations: We
9954 make the INTO token right-associative, and we give it higher precedence than
9955 an empty from clause, using the artificial token EMPTY_FROM_CLAUSE.
9956
9957 The remaining problem is that now we allow the leading INTO anywhere, when
9958 it should be allowed on the top level only. We solve this by manually
9959 throwing parse errors whenever we reduce a nested query expression if it
9960 contains an into clause.
9961 */
9962 select_stmt_with_into:
9963 '(' select_stmt_with_into ')'
9964 {
9965 9 $$ = $2;
9966 }
9967 | query_expression into_clause
9968 {
9969
1/2
✓ Branch 0 taken 15308 times.
✗ Branch 1 not taken.
15308 $$ = NEW_PTN PT_select_stmt($1, $2);
9970 }
9971 | query_expression into_clause locking_clause_list
9972 {
9973
3/6
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 $$ = NEW_PTN PT_select_stmt(NEW_PTN PT_locking($1, $3), $2, true);
9974 }
9975 | query_expression locking_clause_list into_clause
9976 {
9977
3/6
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
32 $$ = NEW_PTN PT_select_stmt(NEW_PTN PT_locking($1, $2), $3);
9978 }
9979 | query_expression_parens into_clause
9980 {
9981
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 $$ = NEW_PTN PT_select_stmt($1, $2);
9982 }
9983 ;
9984
9985 /**
9986 A <query_expression> within parentheses can be used as an <expr>. Now,
9987 because both a <query_expression> and an <expr> can appear syntactically
9988 within any number of parentheses, we get an ambiguous grammar: Where do the
9989 parentheses belong? Techically, we have to tell Bison by which rule to
9990 reduce the extra pair of parentheses. We solve it in a somewhat tedious way
9991 by defining a query_expression so that it can't have enclosing
9992 parentheses. This forces us to be very explicit about exactly where we allow
9993 parentheses; while the standard defines only one rule for <query expression>
9994 parentheses, we have to do it in several places. But this is a blessing in
9995 disguise, as we are able to define our syntax in a more fine-grained manner,
9996 and this is necessary in order to support some MySQL extensions, for example
9997 as in the last two sub-rules here.
9998
9999 Even if we define a query_expression not to have outer parentheses, we still
10000 get a shift/reduce conflict for the <subquery> rule, but we solve this by
10001 using an artifical token SUBQUERY_AS_EXPR that has less priority than
10002 parentheses. This ensures that the parser consumes as many parentheses as it
10003 can, and only when that fails will it try to reduce, and by then it will be
10004 clear from the lookahead token whether we have a subquery or just a
10005 query_expression within parentheses. For example, if the lookahead token is
10006 UNION it's just a query_expression within parentheses and the parentheses
10007 don't mean it's a subquery. If the next token is PLUS, we know it must be an
10008 <expr> and the parentheses really mean it's a subquery.
10009
10010 A word about CTE's: The rules below are duplicated, one with a with_clause
10011 and one without, instead of using a single rule with an opt_with_clause. The
10012 reason we do this is because it would make Bison try to cram both rules into
10013 a single state, where it would have to decide whether to reduce a with_clause
10014 before seeing the rest of the input. This way we force Bison to parse the
10015 entire query expression before trying to reduce.
10016 */
10017 query_expression:
10018 query_expression_body
10019 opt_order_clause
10020 opt_limit_clause
10021 {
10022
2/4
✓ Branch 0 taken 9329096 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9329099 times.
✗ Branch 3 not taken.
9329095 $$ = NEW_PTN PT_query_expression($1, $2, $3);
10023 }
10024 | with_clause
10025 query_expression_body
10026 opt_order_clause
10027 opt_limit_clause
10028 {
10029
2/4
✓ Branch 0 taken 7169 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7169 times.
✗ Branch 3 not taken.
7169 $$= NEW_PTN PT_query_expression($1, $2, $3, $4);
10030 }
10031 | query_expression_parens
10032 order_clause
10033 opt_limit_clause
10034 {
10035
2/4
✓ Branch 0 taken 114 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 114 times.
✗ Branch 3 not taken.
114 $$= NEW_PTN PT_query_expression($1, $2, $3);
10036 }
10037 | with_clause
10038 query_expression_parens
10039 order_clause
10040 opt_limit_clause
10041 {
10042
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 $$= NEW_PTN PT_query_expression($1, $2, $3, $4);
10043 }
10044 | query_expression_parens
10045 limit_clause
10046 {
10047
2/4
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
✗ Branch 3 not taken.
28 $$ = NEW_PTN PT_query_expression($1, nullptr, $2);
10048 }
10049 | with_clause
10050 query_expression_parens
10051 limit_clause
10052 {
10053
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 $$ = NEW_PTN PT_query_expression($1, $2, nullptr, $3);
10054 }
10055 | with_clause
10056 query_expression_parens
10057 {
10058
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 $$ = NEW_PTN PT_query_expression($1, $2, nullptr, nullptr);
10059 }
10060 ;
10061
10062 query_expression_body:
10063 query_primary
10064 {
10065 9331516 $$ = $1;
10066 }
10067 | query_expression_body UNION_SYM union_option query_primary
10068 {
10069
2/4
✓ Branch 0 taken 53132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 53132 times.
✗ Branch 3 not taken.
53132 $$ = NEW_PTN PT_union($1, @1, $3, $4);
10070 }
10071 | query_expression_parens UNION_SYM union_option query_primary
10072 {
10073
2/4
✓ Branch 0 taken 1676 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1676 times.
✗ Branch 3 not taken.
1676 $$ = NEW_PTN PT_union($1, @1, $3, $4);
10074 }
10075 | query_expression_body UNION_SYM union_option query_expression_parens
10076 {
10077
2/4
✓ Branch 0 taken 4101 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4101 times.
✗ Branch 3 not taken.
4101 $$ = NEW_PTN PT_union($1, @1, $3, $4, true);
10078 }
10079 | query_expression_parens UNION_SYM union_option query_expression_parens
10080 {
10081
2/4
✓ Branch 0 taken 3085 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3085 times.
✗ Branch 3 not taken.
3085 $$ = NEW_PTN PT_union($1, @1, $3, $4, true);
10082 }
10083 ;
10084
10085
10086 query_expression_parens:
10087 715 '(' query_expression_parens ')' { $$= $2; }
10088 301738 | '(' query_expression')' { $$= $2; }
10089 | '(' query_expression locking_clause_list')'
10090 {
10091
2/4
✓ Branch 0 taken 141 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 141 times.
✗ Branch 3 not taken.
141 $$ = NEW_PTN PT_locking($2, $3);
10092 }
10093 ;
10094
10095 query_primary:
10096 query_specification
10097 {
10098 // Bison doesn't get polymorphism.
10099 9386139 $$= $1;
10100 }
10101 | table_value_constructor
10102 {
10103
2/4
✓ Branch 0 taken 171 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 171 times.
✗ Branch 3 not taken.
171 $$= NEW_PTN PT_table_value_constructor($1);
10104 }
10105 | explicit_table
10106 {
10107
2/4
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
✗ Branch 3 not taken.
13 auto item_list= NEW_PTN PT_select_item_list;
10108
2/4
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
✗ Branch 3 not taken.
13 auto asterisk= NEW_PTN Item_asterisk(@$, nullptr, nullptr);
10109
3/6
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 13 times.
26 if (item_list == nullptr || asterisk == nullptr ||
10110
2/4
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 13 times.
13 item_list->push_back(asterisk))
10111 MYSQL_YYABORT;
10112
2/4
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
✗ Branch 3 not taken.
13 $$= NEW_PTN PT_explicit_table({}, item_list, $1);
10113 }
10114 ;
10115
10116 query_specification:
10117 SELECT_SYM
10118 select_options
10119 select_item_list
10120 into_clause
10121 opt_from_clause
10122 opt_where_clause
10123 opt_group_clause
10124 opt_having_clause
10125 opt_window_clause
10126 {
10127
1/2
✓ Branch 0 taken 167125 times.
✗ Branch 1 not taken.
334250 $$= NEW_PTN PT_query_specification(
10128 167125 $1, // SELECT_SYM
10129 167125 $2, // select_options
10130 167125 $3, // select_item_list
10131 167125 $4, // into_clause
10132 167125 $5, // from
10133 167125 $6, // where
10134 167125 $7, // group
10135 167125 $8, // having
10136 $9, // windows
10137
2/4
✓ Branch 0 taken 167125 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 167125 times.
✗ Branch 3 not taken.
334249 @5.raw.is_empty()); // implicit FROM
10138 }
10139 | SELECT_SYM
10140 select_options
10141 select_item_list
10142 opt_from_clause
10143 opt_where_clause
10144 opt_group_clause
10145 opt_having_clause
10146 opt_window_clause
10147 {
10148
1/2
✓ Branch 0 taken 9219019 times.
✗ Branch 1 not taken.
18438035 $$= NEW_PTN PT_query_specification(
10149 9219019 $1, // SELECT_SYM
10150 9219019 $2, // select_options
10151 9219019 $3, // select_item_list
10152 NULL,// no INTO clause
10153 9219019 $4, // from
10154 9219019 $5, // where
10155 9219019 $6, // group
10156 9219019 $7, // having
10157 $8, // windows
10158
2/4
✓ Branch 0 taken 9219016 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9219016 times.
✗ Branch 3 not taken.
18438036 @4.raw.is_empty()); // implicit FROM
10159 }
10160 ;
10161
10162 opt_from_clause:
10163 7188819 /* Empty. */ %prec EMPTY_FROM_CLAUSE { $$.init(YYMEM_ROOT); }
10164 | from_clause
10165 ;
10166
10167 from_clause:
10168 2197337 FROM from_tables { $$= $2; }
10169 ;
10170
10171 from_tables:
10172 1157 DUAL_SYM { $$.init(YYMEM_ROOT); }
10173 | table_reference_list
10174 ;
10175
10176 table_reference_list:
10177 table_reference
10178 {
10179 2361351 $$.init(YYMEM_ROOT);
10180
2/4
✓ Branch 0 taken 2361349 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2361349 times.
2361349 if ($$.push_back($1))
10181 MYSQL_YYABORT; // OOM
10182 }
10183 | table_reference_list ',' table_reference
10184 {
10185 83450 $$= $1;
10186
2/4
✓ Branch 0 taken 83450 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 83450 times.
83450 if ($$.push_back($3))
10187 MYSQL_YYABORT; // OOM
10188 }
10189 ;
10190
10191 table_value_constructor:
10192 VALUES values_row_list
10193 {
10194 171 $$= $2;
10195 }
10196 ;
10197
10198 explicit_table:
10199 TABLE_SYM table_ident
10200 {
10201 13 $$.init(YYMEM_ROOT);
10202 auto table= NEW_PTN
10203
2/4
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
✗ Branch 3 not taken.
13 PT_table_factor_table_ident($2, nullptr, NULL_CSTR, nullptr);
10204
2/4
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 13 times.
13 if ($$.push_back(table))
10205 MYSQL_YYABORT; // OOM
10206 }
10207 ;
10208
10209 select_options:
10210 /* empty*/
10211 {
10212 9372671 $$.query_spec_options= 0;
10213 }
10214 | select_option_list
10215 ;
10216
10217 select_option_list:
10218 select_option_list select_option
10219 {
10220
2/4
✓ Branch 0 taken 79 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 79 times.
79 if ($$.merge($1, $2))
10221 MYSQL_YYABORT;
10222 }
10223 | select_option
10224 ;
10225
10226 select_option:
10227 query_spec_option
10228 {
10229 12863 $$.query_spec_options= $1;
10230 }
10231 | SQL_NO_CACHE_SYM
10232 {
10233
1/2
✓ Branch 0 taken 1157 times.
✗ Branch 1 not taken.
1157 push_deprecated_warn_no_replacement(YYTHD, "SQL_NO_CACHE");
10234 /* Ignored since MySQL 8.0. */
10235 1157 $$.query_spec_options= 0;
10236 }
10237 ;
10238
10239 locking_clause_list:
10240 locking_clause_list locking_clause
10241 {
10242 62 $$= $1;
10243
2/4
✓ Branch 0 taken 62 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 62 times.
62 if ($$->push_back($2))
10244 MYSQL_YYABORT; // OOM
10245 }
10246 | locking_clause
10247 {
10248
2/4
✓ Branch 0 taken 1550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1550 times.
✗ Branch 3 not taken.
1550 $$= NEW_PTN PT_locking_clause_list(YYTHD->mem_root);
10249
4/8
✓ Branch 0 taken 1550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1550 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1550 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1550 times.
1550 if ($$ == nullptr || $$->push_back($1))
10250 MYSQL_YYABORT; // OOM
10251 }
10252 ;
10253
10254 locking_clause:
10255 FOR_SYM lock_strength opt_locked_row_action
10256 {
10257
2/4
✓ Branch 0 taken 1207 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1207 times.
✗ Branch 3 not taken.
1207 $$= NEW_PTN PT_query_block_locking_clause($2, $3);
10258 }
10259 | FOR_SYM lock_strength table_locking_list opt_locked_row_action
10260 {
10261
2/4
✓ Branch 0 taken 253 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 253 times.
✗ Branch 3 not taken.
253 $$= NEW_PTN PT_table_locking_clause($2, $3, $4);
10262 }
10263 | LOCK_SYM IN_SYM SHARE_SYM MODE_SYM
10264 {
10265
2/4
✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 152 times.
✗ Branch 3 not taken.
152 $$= NEW_PTN PT_query_block_locking_clause(Lock_strength::SHARE);
10266 }
10267 ;
10268
10269 lock_strength:
10270 1121 UPDATE_SYM { $$= Lock_strength::UPDATE; }
10271 339 | SHARE_SYM { $$= Lock_strength::SHARE; }
10272 ;
10273
10274 table_locking_list:
10275 253 OF_SYM table_alias_ref_list { $$= $2; }
10276 ;
10277
10278 opt_locked_row_action:
10279 1232 /* Empty */ { $$= Locked_row_action::WAIT; }
10280 | locked_row_action
10281 ;
10282
10283 locked_row_action:
10284 112 SKIP_SYM LOCKED_SYM { $$= Locked_row_action::SKIP; }
10285 116 | NOWAIT_SYM { $$= Locked_row_action::NOWAIT; }
10286 ;
10287
10288 select_item_list:
10289 select_item_list ',' select_item
10290 {
10291
4/8
✓ Branch 0 taken 11146571 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11146570 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 11146570 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 11146570 times.
11146571 if ($1 == NULL || $1->push_back($3))
10292 MYSQL_YYABORT;
10293 11146570 $$= $1;
10294 }
10295 | select_item
10296 {
10297
2/4
✓ Branch 0 taken 8876152 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8876155 times.
✗ Branch 3 not taken.
8876157 $$= NEW_PTN PT_select_item_list;
10298
4/8
✓ Branch 0 taken 8876157 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8876157 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8876157 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 8876155 times.
8876155 if ($$ == NULL || $$->push_back($1))
10299 MYSQL_YYABORT;
10300 }
10301 | '*'
10302 {
10303
2/4
✓ Branch 0 taken 525158 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 525158 times.
✗ Branch 3 not taken.
525158 Item *item = NEW_PTN Item_asterisk(@$, nullptr, nullptr);
10304
2/4
✓ Branch 0 taken 525158 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 525158 times.
✗ Branch 3 not taken.
525158 $$ = NEW_PTN PT_select_item_list;
10305
5/10
✓ Branch 0 taken 525158 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 525158 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 525158 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 525158 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 525158 times.
525158 if ($$ == nullptr || item == nullptr || $$->push_back(item))
10306 MYSQL_YYABORT;
10307 }
10308 ;
10309
10310 select_item:
10311 4382 table_wild { $$= $1; }
10312 | expr select_alias
10313 {
10314
2/4
✓ Branch 0 taken 20018337 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20018346 times.
✗ Branch 3 not taken.
20018340 $$= NEW_PTN PTI_expr_with_alias(@$, $1, @1.cpp, to_lex_cstring($2));
10315 }
10316 ;
10317
10318
10319 select_alias:
10320 31633693 /* empty */ { $$=null_lex_str;}
10321 9717649 | AS ident { $$=$2; }
10322 107606 | AS TEXT_STRING_validated { $$=$2; }
10323 73050 | ident { $$=$1; }
10324 3721 | TEXT_STRING_validated { $$=$1; }
10325 ;
10326
10327 optional_braces:
10328 /* empty */ {}
10329 | '(' ')' {}
10330 ;
10331
10332 /* all possible expressions */
10333 expr:
10334 expr or expr %prec OR_SYM
10335 {
10336 1095866 $$= flatten_associative_operator<Item_cond_or,
10337 1095866 Item_func::COND_OR_FUNC>(
10338
1/2
✓ Branch 0 taken 1095866 times.
✗ Branch 1 not taken.
1095866 YYMEM_ROOT, @$, $1, $3);
10339 }
10340 | expr XOR expr %prec XOR
10341 {
10342 /* XOR is a proprietary extension */
10343
2/4
✓ Branch 0 taken 264 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 264 times.
✗ Branch 3 not taken.
264 $$ = NEW_PTN Item_func_xor(@$, $1, $3);
10344 }
10345 | expr and expr %prec AND_SYM
10346 {
10347 2376318 $$= flatten_associative_operator<Item_cond_and,
10348 2376318 Item_func::COND_AND_FUNC>(
10349
1/2
✓ Branch 0 taken 2376318 times.
✗ Branch 1 not taken.
2376319 YYMEM_ROOT, @$, $1, $3);
10350 }
10351 | NOT_SYM expr %prec NOT_SYM
10352 {
10353
2/4
✓ Branch 0 taken 35379 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35379 times.
✗ Branch 3 not taken.
35379 $$= NEW_PTN PTI_truth_transform(@$, $2, Item::BOOL_NEGATED);
10354 }
10355 | bool_pri IS TRUE_SYM %prec IS
10356 {
10357
2/4
✓ Branch 0 taken 186 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 186 times.
✗ Branch 3 not taken.
186 $$= NEW_PTN PTI_truth_transform(@$, $1, Item::BOOL_IS_TRUE);
10358 }
10359 | bool_pri IS not TRUE_SYM %prec IS
10360 {
10361
2/4
✓ Branch 0 taken 55 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 55 times.
✗ Branch 3 not taken.
55 $$= NEW_PTN PTI_truth_transform(@$, $1, Item::BOOL_NOT_TRUE);
10362 }
10363 | bool_pri IS FALSE_SYM %prec IS
10364 {
10365
2/4
✓ Branch 0 taken 91489 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 91489 times.
✗ Branch 3 not taken.
91489 $$= NEW_PTN PTI_truth_transform(@$, $1, Item::BOOL_IS_FALSE);
10366 }
10367 | bool_pri IS not FALSE_SYM %prec IS
10368 {
10369
2/4
✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
✗ Branch 3 not taken.
31 $$= NEW_PTN PTI_truth_transform(@$, $1, Item::BOOL_NOT_FALSE);
10370 }
10371 | bool_pri IS UNKNOWN_SYM %prec IS
10372 {
10373
2/4
✓ Branch 0 taken 128 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 128 times.
✗ Branch 3 not taken.
128 $$= NEW_PTN Item_func_isnull(@$, $1);
10374 }
10375 | bool_pri IS not UNKNOWN_SYM %prec IS
10376 {
10377
2/4
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
15 $$= NEW_PTN Item_func_isnotnull(@$, $1);
10378 }
10379 | bool_pri %prec SET_VAR
10380 ;
10381
10382 bool_pri:
10383 bool_pri IS NULL_SYM %prec IS
10384 {
10385
2/4
✓ Branch 0 taken 1148125 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1148125 times.
✗ Branch 3 not taken.
1148125 $$= NEW_PTN Item_func_isnull(@$, $1);
10386 }
10387 | bool_pri IS not NULL_SYM %prec IS
10388 {
10389
2/4
✓ Branch 0 taken 86364 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 86364 times.
✗ Branch 3 not taken.
86364 $$= NEW_PTN Item_func_isnotnull(@$, $1);
10390 }
10391 | bool_pri comp_op predicate
10392 {
10393
2/4
✓ Branch 0 taken 12366836 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12366828 times.
✗ Branch 3 not taken.
12366846 $$= NEW_PTN PTI_comp_op(@$, $1, $2, $3);
10394 }
10395 | bool_pri comp_op all_or_any table_subquery %prec EQ
10396 {
10397
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2934 times.
2935 if ($2 == &comp_equal_creator)
10398 /*
10399 We throw this manual parse error rather than split the rule
10400 comp_op into a null-safe and a non null-safe rule, since doing
10401 so would add a shift/reduce conflict. It's actually this rule
10402 and the ones referencing it that cause all the conflicts, but
10403 we still don't want the count to go up.
10404 */
10405
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error_at(@2);
10406
2/4
✓ Branch 0 taken 2935 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2935 times.
✗ Branch 3 not taken.
2935 $$= NEW_PTN PTI_comp_op_all(@$, $1, $2, $3, $4);
10407 }
10408 | predicate %prec SET_VAR
10409 ;
10410
10411 predicate:
10412 bit_expr IN_SYM table_subquery
10413 {
10414
2/4
✓ Branch 0 taken 43985 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 43985 times.
✗ Branch 3 not taken.
43985 $$= NEW_PTN Item_in_subselect(@$, $1, $3);
10415 }
10416 | bit_expr not IN_SYM table_subquery
10417 {
10418
2/4
✓ Branch 0 taken 3399 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3399 times.
✗ Branch 3 not taken.
3399 Item *item= NEW_PTN Item_in_subselect(@$, $1, $4);
10419
2/4
✓ Branch 0 taken 3399 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3399 times.
✗ Branch 3 not taken.
3399 $$= NEW_PTN PTI_truth_transform(@$, item, Item::BOOL_NEGATED);
10420 }
10421 | bit_expr IN_SYM '(' expr ')'
10422 {
10423
2/4
✓ Branch 0 taken 4178 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4178 times.
✗ Branch 3 not taken.
4178 $$= NEW_PTN PTI_handle_sql2003_note184_exception(@$, $1, true, $4);
10424 }
10425 | bit_expr IN_SYM '(' expr ',' expr_list ')'
10426 {
10427
6/12
✓ Branch 0 taken 114732 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 114732 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 114732 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 114732 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 114732 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 114732 times.
114732 if ($6 == NULL || $6->push_front($4) || $6->push_front($1))
10428 MYSQL_YYABORT;
10429
10430
2/4
✓ Branch 0 taken 114732 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 114732 times.
✗ Branch 3 not taken.
114732 $$= NEW_PTN Item_func_in(@$, $6, false);
10431 }
10432 | bit_expr not IN_SYM '(' expr ')'
10433 {
10434
2/4
✓ Branch 0 taken 1026 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1026 times.
✗ Branch 3 not taken.
1026 $$= NEW_PTN PTI_handle_sql2003_note184_exception(@$, $1, false, $5);
10435 }
10436 | bit_expr not IN_SYM '(' expr ',' expr_list ')'
10437 {
10438
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 184021 times.
184021 if ($7 == nullptr)
10439 MYSQL_YYABORT;
10440
1/2
✓ Branch 0 taken 184021 times.
✗ Branch 1 not taken.
184021 $7->push_front($5);
10441
1/2
✓ Branch 0 taken 184021 times.
✗ Branch 1 not taken.
184021 $7->value.push_front($1);
10442
10443
2/4
✓ Branch 0 taken 184021 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 184021 times.
✗ Branch 3 not taken.
184021 $$= NEW_PTN Item_func_in(@$, $7, true);
10444 }
10445 | bit_expr MEMBER_SYM opt_of '(' simple_expr ')'
10446 {
10447
2/4
✓ Branch 0 taken 506 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 506 times.
✗ Branch 3 not taken.
506 $$= NEW_PTN Item_func_member_of(@$, $1, $5);
10448 }
10449 | bit_expr BETWEEN_SYM bit_expr AND_SYM predicate
10450 {
10451
2/4
✓ Branch 0 taken 37639 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37638 times.
✗ Branch 3 not taken.
37638 $$= NEW_PTN Item_func_between(@$, $1, $3, $5, false);
10452 }
10453 | bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate
10454 {
10455
2/4
✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 216 times.
✗ Branch 3 not taken.
216 $$= NEW_PTN Item_func_between(@$, $1, $4, $6, true);
10456 }
10457 | bit_expr SOUNDS_SYM LIKE bit_expr
10458 {
10459
2/4
✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 33 times.
✗ Branch 3 not taken.
33 Item *item1= NEW_PTN Item_func_soundex(@$, $1);
10460
2/4
✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 33 times.
✗ Branch 3 not taken.
33 Item *item4= NEW_PTN Item_func_soundex(@$, $4);
10461
2/4
✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 33 times.
33 if ((item1 == NULL) || (item4 == NULL))
10462 MYSQL_YYABORT;
10463
2/4
✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 33 times.
✗ Branch 3 not taken.
33 $$= NEW_PTN Item_func_eq(@$, item1, item4);
10464 }
10465 | bit_expr LIKE simple_expr
10466 {
10467
2/4
✓ Branch 0 taken 153499 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 153499 times.
✗ Branch 3 not taken.
153499 $$ = NEW_PTN Item_func_like(@$, $1, $3);
10468 }
10469 | bit_expr LIKE simple_expr ESCAPE_SYM simple_expr %prec LIKE
10470 {
10471
2/4
✓ Branch 0 taken 14672 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14672 times.
✗ Branch 3 not taken.
14672 $$ = NEW_PTN Item_func_like(@$, $1, $3, $5);
10472 }
10473 | bit_expr not LIKE simple_expr
10474 {
10475
2/4
✓ Branch 0 taken 184015 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 184015 times.
✗ Branch 3 not taken.
184015 auto item = NEW_PTN Item_func_like(@$, $1, $4);
10476
2/4
✓ Branch 0 taken 184015 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 184015 times.
✗ Branch 3 not taken.
184015 $$ = NEW_PTN Item_func_not(@$, item);
10477 }
10478 | bit_expr not LIKE simple_expr ESCAPE_SYM simple_expr %prec LIKE
10479 {
10480
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 auto item = NEW_PTN Item_func_like(@$, $1, $4, $6);
10481
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 $$ = NEW_PTN Item_func_not(@$, item);
10482 }
10483 | bit_expr REGEXP bit_expr
10484 {
10485
2/4
✓ Branch 0 taken 116989 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116989 times.
✗ Branch 3 not taken.
116989 auto args= NEW_PTN PT_item_list;
10486
1/2
✓ Branch 0 taken 116989 times.
✗ Branch 1 not taken.
116989 args->push_back($1);
10487
1/2
✓ Branch 0 taken 116989 times.
✗ Branch 1 not taken.
116989 args->push_back($3);
10488
10489
2/4
✓ Branch 0 taken 116989 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116989 times.
✗ Branch 3 not taken.
116989 $$= NEW_PTN Item_func_regexp_like(@1, args);
10490 }
10491 | bit_expr not REGEXP bit_expr
10492 {
10493
2/4
✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 74 times.
✗ Branch 3 not taken.
74 auto args= NEW_PTN PT_item_list;
10494
1/2
✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
74 args->push_back($1);
10495
1/2
✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
74 args->push_back($4);
10496
2/4
✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 74 times.
✗ Branch 3 not taken.
74 Item *item= NEW_PTN Item_func_regexp_like(@$, args);
10497
2/4
✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 74 times.
✗ Branch 3 not taken.
74 $$= NEW_PTN PTI_truth_transform(@$, item, Item::BOOL_NEGATED);
10498 }
10499 | bit_expr %prec SET_VAR
10500 ;
10501
10502 opt_of:
10503 OF_SYM
10504 |
10505 ;
10506
10507 bit_expr:
10508 bit_expr '|' bit_expr %prec '|'
10509 {
10510
2/4
✓ Branch 0 taken 2498 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2498 times.
✗ Branch 3 not taken.
2498 $$= NEW_PTN Item_func_bit_or(@$, $1, $3);
10511 }
10512 | bit_expr '&' bit_expr %prec '&'
10513 {
10514
2/4
✓ Branch 0 taken 67885 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 67885 times.
✗ Branch 3 not taken.
67885 $$= NEW_PTN Item_func_bit_and(@$, $1, $3);
10515 }
10516 | bit_expr SHIFT_LEFT bit_expr %prec SHIFT_LEFT
10517 {
10518
2/4
✓ Branch 0 taken 84098 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 84098 times.
✗ Branch 3 not taken.
84098 $$= NEW_PTN Item_func_shift_left(@$, $1, $3);
10519 }
10520 | bit_expr SHIFT_RIGHT bit_expr %prec SHIFT_RIGHT
10521 {
10522
2/4
✓ Branch 0 taken 61326 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 61326 times.
✗ Branch 3 not taken.
61326 $$= NEW_PTN Item_func_shift_right(@$, $1, $3);
10523 }
10524 | bit_expr '+' bit_expr %prec '+'
10525 {
10526
2/4
✓ Branch 0 taken 1081546 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1081569 times.
✗ Branch 3 not taken.
1081551 $$= NEW_PTN Item_func_plus(@$, $1, $3);
10527 }
10528 | bit_expr '-' bit_expr %prec '-'
10529 {
10530
2/4
✓ Branch 0 taken 961943 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 961957 times.
✗ Branch 3 not taken.
961944 $$= NEW_PTN Item_func_minus(@$, $1, $3);
10531 }
10532 | bit_expr '+' INTERVAL_SYM expr interval %prec '+'
10533 {
10534
2/4
✓ Branch 0 taken 361 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 361 times.
✗ Branch 3 not taken.
361 $$= NEW_PTN Item_date_add_interval(@$, $1, $4, $5, 0);
10535 }
10536 | bit_expr '-' INTERVAL_SYM expr interval %prec '-'
10537 {
10538
2/4
✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
77 $$= NEW_PTN Item_date_add_interval(@$, $1, $4, $5, 1);
10539 }
10540 | bit_expr '*' bit_expr %prec '*'
10541 {
10542
2/4
✓ Branch 0 taken 306597 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 306597 times.
✗ Branch 3 not taken.
306597 $$= NEW_PTN Item_func_mul(@$, $1, $3);
10543 }
10544 | bit_expr '/' bit_expr %prec '/'
10545 {
10546
2/4
✓ Branch 0 taken 384556 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 384556 times.
✗ Branch 3 not taken.
384556 $$= NEW_PTN Item_func_div(@$, $1,$3);
10547 }
10548 | bit_expr '%' bit_expr %prec '%'
10549 {
10550
2/4
✓ Branch 0 taken 11942 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11942 times.
✗ Branch 3 not taken.
11942 $$= NEW_PTN Item_func_mod(@$, $1,$3);
10551 }
10552 | bit_expr DIV_SYM bit_expr %prec DIV_SYM
10553 {
10554
2/4
✓ Branch 0 taken 36392 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 36392 times.
✗ Branch 3 not taken.
36392 $$= NEW_PTN Item_func_div_int(@$, $1,$3);
10555 }
10556 | bit_expr MOD_SYM bit_expr %prec MOD_SYM
10557 {
10558
2/4
✓ Branch 0 taken 67009 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 67009 times.
✗ Branch 3 not taken.
67009 $$= NEW_PTN Item_func_mod(@$, $1, $3);
10559 }
10560 | bit_expr '^' bit_expr
10561 {
10562
2/4
✓ Branch 0 taken 310 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 310 times.
✗ Branch 3 not taken.
310 $$= NEW_PTN Item_func_bit_xor(@$, $1, $3);
10563 }
10564 | simple_expr %prec SET_VAR
10565 ;
10566
10567 or:
10568 OR_SYM
10569 | OR2_SYM
10570 ;
10571
10572 and:
10573 AND_SYM
10574 | AND_AND_SYM
10575 {
10576
1/2
✓ Branch 0 taken 1414 times.
✗ Branch 1 not taken.
1414 push_deprecated_warn(YYTHD, "&&", "AND");
10577 }
10578 ;
10579
10580 not:
10581 NOT_SYM
10582 | NOT2_SYM
10583 ;
10584
10585 not2:
10586
1/2
✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
53 '!' { push_deprecated_warn(YYTHD, "!", "NOT"); }
10587 | NOT2_SYM
10588 ;
10589
10590 comp_op:
10591 9577069 EQ { $$ = &comp_eq_creator; }
10592 3069 | EQUAL_SYM { $$ = &comp_equal_creator; }
10593 31921 | GE { $$ = &comp_ge_creator; }
10594 203354 | GT_SYM { $$ = &comp_gt_creator; }
10595 499354 | LE { $$ = &comp_le_creator; }
10596 64258 | LT { $$ = &comp_lt_creator; }
10597 1990751 | NE { $$ = &comp_ne_creator; }
10598 ;
10599
10600 all_or_any:
10601 1300 ALL { $$ = 1; }
10602 1635 | ANY_SYM { $$ = 0; }
10603 ;
10604
10605 simple_expr:
10606 simple_ident
10607 | function_call_keyword
10608 | function_call_nonkeyword
10609 | function_call_generic
10610 | function_call_conflict
10611 | simple_expr COLLATE_SYM ident_or_text %prec NEG
10612 {
10613
2/4
✓ Branch 0 taken 95185 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 95185 times.
✗ Branch 3 not taken.
95185 $$= NEW_PTN Item_func_set_collation(@$, $1, $3);
10614 }
10615 | literal_or_null
10616 284751 | param_marker { $$= $1; }
10617 | rvalue_system_or_user_variable
10618 | in_expression_user_variable_assignment
10619 | set_function_specification
10620 | window_func_call
10621 | simple_expr OR_OR_SYM simple_expr
10622 {
10623
2/4
✓ Branch 0 taken 219 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 219 times.
✗ Branch 3 not taken.
219 $$= NEW_PTN Item_func_concat(@$, $1, $3);
10624 }
10625 | '+' simple_expr %prec NEG
10626 {
10627 2219 $$= $2; // TODO: do we really want to ignore unary '+' before any kind of literals?
10628 }
10629 | '-' simple_expr %prec NEG
10630 {
10631
2/4
✓ Branch 0 taken 241541 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 241541 times.
✗ Branch 3 not taken.
241541 $$= NEW_PTN Item_func_neg(@$, $2);
10632 }
10633 | '~' simple_expr %prec NEG
10634 {
10635
2/4
✓ Branch 0 taken 85 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 85 times.
✗ Branch 3 not taken.
85 $$= NEW_PTN Item_func_bit_neg(@$, $2);
10636 }
10637 | not2 simple_expr %prec NEG
10638 {
10639
2/4
✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 64 times.
✗ Branch 3 not taken.
64 $$= NEW_PTN PTI_truth_transform(@$, $2, Item::BOOL_NEGATED);
10640 }
10641 | row_subquery
10642 {
10643
2/4
✓ Branch 0 taken 205747 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 205747 times.
✗ Branch 3 not taken.
205747 $$= NEW_PTN PTI_singlerow_subselect(@$, $1);
10644 }
10645 13055051 | '(' expr ')' { $$= $2; }
10646 | '(' expr ',' expr_list ')'
10647 {
10648
2/4
✓ Branch 0 taken 4487 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4487 times.
✗ Branch 3 not taken.
4487 $$= NEW_PTN Item_row(@$, $2, $4->value);
10649 }
10650 | ROW_SYM '(' expr ',' expr_list ')'
10651 {
10652
2/4
✓ Branch 0 taken 1087 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1087 times.
✗ Branch 3 not taken.
1087 $$= NEW_PTN Item_row(@$, $3, $5->value);
10653 }
10654 | EXISTS table_subquery
10655 {
10656
2/4
✓ Branch 0 taken 4634 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4634 times.
✗ Branch 3 not taken.
4634 $$= NEW_PTN PTI_exists_subselect(@$, $2);
10657 }
10658 | '{' ident expr '}'
10659 {
10660
2/4
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
25 $$= NEW_PTN PTI_odbc_date(@$, $2, $3);
10661 }
10662 | MATCH ident_list_arg AGAINST '(' bit_expr fulltext_options ')'
10663 {
10664
2/4
✓ Branch 0 taken 2756 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2756 times.
✗ Branch 3 not taken.
2756 $$= NEW_PTN Item_func_match(@$, $2, $5, $6);
10665 }
10666 | BINARY_SYM simple_expr %prec NEG
10667 {
10668
1/2
✓ Branch 0 taken 808 times.
✗ Branch 1 not taken.
808 push_deprecated_warn(YYTHD, "BINARY expr", "CAST");
10669
1/2
✓ Branch 0 taken 808 times.
✗ Branch 1 not taken.
808 $$= create_func_cast(YYTHD, @2, $2, ITEM_CAST_CHAR, &my_charset_bin);
10670 }
10671 | CAST_SYM '(' expr AS cast_type opt_array_cast ')'
10672 {
10673
1/2
✓ Branch 0 taken 1184066 times.
✗ Branch 1 not taken.
1184066 $$= create_func_cast(YYTHD, @3, $3, $5, $6);
10674 }
10675 | CAST_SYM '(' expr AT_SYM LOCAL_SYM AS cast_type opt_array_cast ')'
10676 {
10677
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_NOT_SUPPORTED_YET, MYF(0), "AT LOCAL");
10678 }
10679 | CAST_SYM '(' expr AT_SYM TIME_SYM ZONE_SYM opt_interval
10680 TEXT_STRING_literal AS DATETIME_SYM type_datetime_precision ')'
10681 {
10682 17 Cast_type cast_type{ITEM_CAST_DATETIME, nullptr, nullptr, $11};
10683 auto datetime_factor =
10684
2/4
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
✗ Branch 3 not taken.
17 NEW_PTN Item_func_at_time_zone(@3, $3, $8.str, $7);
10685
1/2
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
17 $$ = create_func_cast(YYTHD, @3, datetime_factor, cast_type, false);
10686 }
10687 | CASE_SYM opt_expr when_list opt_else END
10688 {
10689
2/4
✓ Branch 0 taken 249209 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 249209 times.
✗ Branch 3 not taken.
249209 $$= NEW_PTN Item_func_case(@$, $3, $2, $4 );
10690 }
10691 | CONVERT_SYM '(' expr ',' cast_type ')'
10692 {
10693
1/2
✓ Branch 0 taken 179 times.
✗ Branch 1 not taken.
179 $$= create_func_cast(YYTHD, @3, $3, $5, false);
10694 }
10695 | CONVERT_SYM '(' expr USING charset_name ')'
10696 {
10697
2/4
✓ Branch 0 taken 115065 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 115065 times.
✗ Branch 3 not taken.
115065 $$= NEW_PTN Item_func_conv_charset(@$, $3,$5);
10698 }
10699 | DEFAULT_SYM '(' simple_ident ')'
10700 {
10701
2/4
✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 61 times.
✗ Branch 3 not taken.
61 $$= NEW_PTN Item_default_value(@$, $3);
10702 }
10703 | VALUES '(' simple_ident_nospvar ')'
10704 {
10705
2/4
✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 83 times.
✗ Branch 3 not taken.
83 $$= NEW_PTN Item_insert_value(@$, $3);
10706 }
10707 | INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM
10708 /* we cannot put interval before - */
10709 {
10710
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 $$= NEW_PTN Item_date_add_interval(@$, $5, $2, $3, 0);
10711 }
10712 | simple_ident JSON_SEPARATOR_SYM TEXT_STRING_literal
10713 {
10714 Item_string *path=
10715 904 NEW_PTN Item_string(@$, $3.str, $3.length,
10716
2/4
✓ Branch 0 taken 904 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 904 times.
✗ Branch 3 not taken.
904 YYTHD->variables.collation_connection);
10717
2/4
✓ Branch 0 taken 904 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 904 times.
✗ Branch 3 not taken.
904 $$= NEW_PTN Item_func_json_extract(YYTHD, @$, $1, path);
10718 }
10719 | simple_ident JSON_UNQUOTED_SEPARATOR_SYM TEXT_STRING_literal
10720 {
10721 Item_string *path=
10722 469 NEW_PTN Item_string(@$, $3.str, $3.length,
10723
2/4
✓ Branch 0 taken 469 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 469 times.
✗ Branch 3 not taken.
469 YYTHD->variables.collation_connection);
10724
2/4
✓ Branch 0 taken 469 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 469 times.
✗ Branch 3 not taken.
469 Item *extr= NEW_PTN Item_func_json_extract(YYTHD, @$, $1, path);
10725
2/4
✓ Branch 0 taken 469 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 469 times.
✗ Branch 3 not taken.
469 $$= NEW_PTN Item_func_json_unquote(@$, extr);
10726 }
10727 ;
10728
10729 opt_array_cast:
10730 1182723 /* empty */ { $$= false; }
10731 1350 | ARRAY_SYM { $$= true; }
10732 ;
10733
10734 /*
10735 Function call syntax using official SQL 2003 keywords.
10736 Because the function name is an official token,
10737 a dedicated grammar rule is needed in the parser.
10738 There is no potential for conflicts
10739 */
10740 function_call_keyword:
10741 CHAR_SYM '(' expr_list ')'
10742 {
10743
2/4
✓ Branch 0 taken 62395 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 62395 times.
✗ Branch 3 not taken.
62395 $$= NEW_PTN Item_func_char(@$, $3);
10744 }
10745 | CHAR_SYM '(' expr_list USING charset_name ')'
10746 {
10747
2/4
✓ Branch 0 taken 106 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 106 times.
✗ Branch 3 not taken.
106 $$= NEW_PTN Item_func_char(@$, $3, $5);
10748 }
10749 | CURRENT_USER optional_braces
10750 {
10751
2/4
✓ Branch 0 taken 2693 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2693 times.
✗ Branch 3 not taken.
2693 $$= NEW_PTN Item_func_current_user(@$);
10752 }
10753 | DATE_SYM '(' expr ')'
10754 {
10755
2/4
✓ Branch 0 taken 437 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 437 times.
✗ Branch 3 not taken.
437 $$= NEW_PTN Item_typecast_date(@$, $3);
10756 }
10757 | DAY_SYM '(' expr ')'
10758 {
10759
2/4
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
✗ Branch 3 not taken.
52 $$= NEW_PTN Item_func_dayofmonth(@$, $3);
10760 }
10761 | HOUR_SYM '(' expr ')'
10762 {
10763
2/4
✓ Branch 0 taken 142 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 142 times.
✗ Branch 3 not taken.
142 $$= NEW_PTN Item_func_hour(@$, $3);
10764 }
10765 | INSERT_SYM '(' expr ',' expr ',' expr ',' expr ')'
10766 {
10767
2/4
✓ Branch 0 taken 6796 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6796 times.
✗ Branch 3 not taken.
6796 $$= NEW_PTN Item_func_insert(@$, $3, $5, $7, $9);
10768 }
10769 | INTERVAL_SYM '(' expr ',' expr ')' %prec INTERVAL_SYM
10770 {
10771
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 $$= NEW_PTN Item_func_interval(@$, YYMEM_ROOT, $3, $5);
10772 }
10773 | INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' %prec INTERVAL_SYM
10774 {
10775
2/4
✓ Branch 0 taken 43 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 43 times.
✗ Branch 3 not taken.
43 $$= NEW_PTN Item_func_interval(@$, YYMEM_ROOT, $3, $5, $7);
10776 }
10777 | JSON_VALUE_SYM '(' simple_expr ',' text_literal
10778 opt_returning_type opt_on_empty_or_error ')'
10779 {
10780 10 $$= create_func_json_value(YYTHD, @3, $3, $5, $6,
10781 10 $7.empty.type, $7.empty.default_string,
10782
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 $7.error.type, $7.error.default_string);
10783 }
10784 | LEFT '(' expr ',' expr ')'
10785 {
10786
2/4
✓ Branch 0 taken 147069 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 147069 times.
✗ Branch 3 not taken.
147069 $$= NEW_PTN Item_func_left(@$, $3, $5);
10787 }
10788 | MINUTE_SYM '(' expr ')'
10789 {
10790
2/4
✓ Branch 0 taken 121 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 121 times.
✗ Branch 3 not taken.
121 $$= NEW_PTN Item_func_minute(@$, $3);
10791 }
10792 | MONTH_SYM '(' expr ')'
10793 {
10794
2/4
✓ Branch 0 taken 245 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 245 times.
✗ Branch 3 not taken.
245 $$= NEW_PTN Item_func_month(@$, $3);
10795 }
10796 | RIGHT '(' expr ',' expr ')'
10797 {
10798
2/4
✓ Branch 0 taken 10509 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10509 times.
✗ Branch 3 not taken.
10509 $$= NEW_PTN Item_func_right(@$, $3, $5);
10799 }
10800 | SECOND_SYM '(' expr ')'
10801 {
10802
2/4
✓ Branch 0 taken 131 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 131 times.
✗ Branch 3 not taken.
131 $$= NEW_PTN Item_func_second(@$, $3);
10803 }
10804 | TIME_SYM '(' expr ')'
10805 {
10806
2/4
✓ Branch 0 taken 125 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 125 times.
✗ Branch 3 not taken.
125 $$= NEW_PTN Item_typecast_time(@$, $3);
10807 }
10808 | TIMESTAMP_SYM '(' expr ')'
10809 {
10810
2/4
✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✗ Branch 3 not taken.
133 $$= NEW_PTN Item_typecast_datetime(@$, $3);
10811 }
10812 | TIMESTAMP_SYM '(' expr ',' expr ')'
10813 {
10814
2/4
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
✗ Branch 3 not taken.
37 $$= NEW_PTN Item_func_add_time(@$, $3, $5, 1, 0);
10815 }
10816 | TRIM '(' expr ')'
10817 {
10818
1/2
✓ Branch 0 taken 40389 times.
✗ Branch 1 not taken.
80778 $$= NEW_PTN Item_func_trim(@$, $3,
10819
1/2
✓ Branch 0 taken 40389 times.
✗ Branch 1 not taken.
80778 Item_func_trim::TRIM_BOTH_DEFAULT);
10820 }
10821 | TRIM '(' LEADING expr FROM expr ')'
10822 {
10823
1/2
✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
114 $$= NEW_PTN Item_func_trim(@$, $6, $4,
10824
1/2
✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
114 Item_func_trim::TRIM_LEADING);
10825 }
10826 | TRIM '(' TRAILING expr FROM expr ')'
10827 {
10828
1/2
✓ Branch 0 taken 2350 times.
✗ Branch 1 not taken.
4700 $$= NEW_PTN Item_func_trim(@$, $6, $4,
10829
1/2
✓ Branch 0 taken 2350 times.
✗ Branch 1 not taken.
4700 Item_func_trim::TRIM_TRAILING);
10830 }
10831 | TRIM '(' BOTH expr FROM expr ')'
10832 {
10833
2/4
✓ Branch 0 taken 1102 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1102 times.
✗ Branch 3 not taken.
1102 $$= NEW_PTN Item_func_trim(@$, $6, $4, Item_func_trim::TRIM_BOTH);
10834 }
10835 | TRIM '(' LEADING FROM expr ')'
10836 {
10837
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 $$= NEW_PTN Item_func_trim(@$, $5, Item_func_trim::TRIM_LEADING);
10838 }
10839 | TRIM '(' TRAILING FROM expr ')'
10840 {
10841
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 $$= NEW_PTN Item_func_trim(@$, $5, Item_func_trim::TRIM_TRAILING);
10842 }
10843 | TRIM '(' BOTH FROM expr ')'
10844 {
10845
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 $$= NEW_PTN Item_func_trim(@$, $5, Item_func_trim::TRIM_BOTH);
10846 }
10847 | TRIM '(' expr FROM expr ')'
10848 {
10849
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
30 $$= NEW_PTN Item_func_trim(@$, $5, $3,
10850
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
30 Item_func_trim::TRIM_BOTH_DEFAULT);
10851 }
10852 | USER '(' ')'
10853 {
10854
2/4
✓ Branch 0 taken 4776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4776 times.
✗ Branch 3 not taken.
4776 $$= NEW_PTN Item_func_user(@$);
10855 }
10856 | YEAR_SYM '(' expr ')'
10857 {
10858
2/4
✓ Branch 0 taken 780 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 780 times.
✗ Branch 3 not taken.
780 $$= NEW_PTN Item_func_year(@$, $3);
10859 }
10860 ;
10861
10862 /*
10863 Function calls using non reserved keywords, with special syntaxic forms.
10864 Dedicated grammar rules are needed because of the syntax,
10865 but also have the potential to cause incompatibilities with other
10866 parts of the language.
10867 MAINTAINER:
10868 The only reasons a function should be added here are:
10869 - for compatibility reasons with another SQL syntax (CURDATE),
10870 - for typing reasons (GET_FORMAT)
10871 Any other 'Syntaxic sugar' enhancements should be *STRONGLY*
10872 discouraged.
10873 */
10874 function_call_nonkeyword:
10875 ADDDATE_SYM '(' expr ',' expr ')'
10876 {
10877
2/4
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
✗ Branch 3 not taken.
28 $$= NEW_PTN Item_date_add_interval(@$, $3, $5, INTERVAL_DAY, 0);
10878 }
10879 | ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
10880 {
10881
2/4
✓ Branch 0 taken 131 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 131 times.
✗ Branch 3 not taken.
131 $$= NEW_PTN Item_date_add_interval(@$, $3, $6, $7, 0);
10882 }
10883 | CURDATE optional_braces
10884 {
10885
2/4
✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
198 $$= NEW_PTN Item_func_curdate_local(@$);
10886 }
10887 | CURTIME func_datetime_precision
10888 {
10889
2/4
✓ Branch 0 taken 270 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 270 times.
✗ Branch 3 not taken.
270 $$= NEW_PTN Item_func_curtime_local(@$, static_cast<uint8>($2));
10890 }
10891 | DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
10892 %prec INTERVAL_SYM
10893 {
10894
2/4
✓ Branch 0 taken 210 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 210 times.
✗ Branch 3 not taken.
210 $$= NEW_PTN Item_date_add_interval(@$, $3, $6, $7, 0);
10895 }
10896 | DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
10897 %prec INTERVAL_SYM
10898 {
10899
2/4
✓ Branch 0 taken 149 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 149 times.
✗ Branch 3 not taken.
149 $$= NEW_PTN Item_date_add_interval(@$, $3, $6, $7, 1);
10900 }
10901 | EXTRACT_SYM '(' interval FROM expr ')'
10902 {
10903
2/4
✓ Branch 0 taken 412 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 412 times.
✗ Branch 3 not taken.
412 $$= NEW_PTN Item_extract(@$, $3, $5);
10904 }
10905 | GET_FORMAT '(' date_time_type ',' expr ')'
10906 {
10907
2/4
✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29 times.
✗ Branch 3 not taken.
29 $$= NEW_PTN Item_func_get_format(@$, $3, $5);
10908 }
10909 | now
10910 {
10911
1/2
✓ Branch 0 taken 118246 times.
✗ Branch 1 not taken.
236524 $$= NEW_PTN PTI_function_call_nonkeyword_now(@$,
10912
1/2
✓ Branch 0 taken 118278 times.
✗ Branch 1 not taken.
236489 static_cast<uint8>($1));
10913 }
10914 | POSITION_SYM '(' bit_expr IN_SYM expr ')'
10915 {
10916
2/4
✓ Branch 0 taken 46 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 46 times.
✗ Branch 3 not taken.
46 $$= NEW_PTN Item_func_locate(@$, $5,$3);
10917 }
10918 | SUBDATE_SYM '(' expr ',' expr ')'
10919 {
10920
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 $$= NEW_PTN Item_date_add_interval(@$, $3, $5, INTERVAL_DAY, 1);
10921 }
10922 | SUBDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
10923 {
10924
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
6 $$= NEW_PTN Item_date_add_interval(@$, $3, $6, $7, 1);
10925 }
10926 | SUBSTRING '(' expr ',' expr ',' expr ')'
10927 {
10928
2/4
✓ Branch 0 taken 2110267 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2110267 times.
✗ Branch 3 not taken.
2110267 $$= NEW_PTN Item_func_substr(@$, $3,$5,$7);
10929 }
10930 | SUBSTRING '(' expr ',' expr ')'
10931 {
10932
2/4
✓ Branch 0 taken 2450388 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2450388 times.
✗ Branch 3 not taken.
2450388 $$= NEW_PTN Item_func_substr(@$, $3,$5);
10933 }
10934 | SUBSTRING '(' expr FROM expr FOR_SYM expr ')'
10935 {
10936
2/4
✓ Branch 0 taken 264 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 264 times.
✗ Branch 3 not taken.
264 $$= NEW_PTN Item_func_substr(@$, $3,$5,$7);
10937 }
10938 | SUBSTRING '(' expr FROM expr ')'
10939 {
10940
2/4
✓ Branch 0 taken 202 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202 times.
✗ Branch 3 not taken.
202 $$= NEW_PTN Item_func_substr(@$, $3,$5);
10941 }
10942 | SYSDATE func_datetime_precision
10943 {
10944
1/2
✓ Branch 0 taken 136 times.
✗ Branch 1 not taken.
272 $$= NEW_PTN PTI_function_call_nonkeyword_sysdate(@$,
10945
1/2
✓ Branch 0 taken 136 times.
✗ Branch 1 not taken.
272 static_cast<uint8>($2));
10946 }
10947 | TIMESTAMP_ADD '(' interval_time_stamp ',' expr ',' expr ')'
10948 {
10949
2/4
✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 40 times.
✗ Branch 3 not taken.
40 $$= NEW_PTN Item_date_add_interval(@$, $7, $5, $3, 0);
10950 }
10951 | TIMESTAMP_DIFF '(' interval_time_stamp ',' expr ',' expr ')'
10952 {
10953
2/4
✓ Branch 0 taken 10708 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10708 times.
✗ Branch 3 not taken.
10708 $$= NEW_PTN Item_func_timestamp_diff(@$, $5,$7,$3);
10954 }
10955 | UTC_DATE_SYM optional_braces
10956 {
10957
2/4
✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35 times.
✗ Branch 3 not taken.
35 $$= NEW_PTN Item_func_curdate_utc(@$);
10958 }
10959 | UTC_TIME_SYM func_datetime_precision
10960 {
10961
2/4
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
✗ Branch 3 not taken.
36 $$= NEW_PTN Item_func_curtime_utc(@$, static_cast<uint8>($2));
10962 }
10963 | UTC_TIMESTAMP_SYM func_datetime_precision
10964 {
10965
2/4
✓ Branch 0 taken 1093 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1093 times.
✗ Branch 3 not taken.
1093 $$= NEW_PTN Item_func_now_utc(@$, static_cast<uint8>($2));
10966 }
10967 ;
10968
10969 // JSON_VALUE's optional JSON returning clause.
10970 opt_returning_type:
10971 // The default returning type is CHAR(512). (The max length of 512
10972 // is chosen so that the returned values are not handled as BLOBs
10973 // internally. See CONVERT_IF_BIGGER_TO_BLOB.)
10974 {
10975 $$= {ITEM_CAST_CHAR, nullptr, "512", nullptr};
10976 }
10977 | RETURNING_SYM cast_type
10978 {
10979 10 $$= $2;
10980 }
10981 ;
10982 /*
10983 Functions calls using a non reserved keyword, and using a regular syntax.
10984 Because the non reserved keyword is used in another part of the grammar,
10985 a dedicated rule is needed here.
10986 */
10987 function_call_conflict:
10988 ASCII_SYM '(' expr ')'
10989 {
10990
2/4
✓ Branch 0 taken 2516 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2516 times.
✗ Branch 3 not taken.
2516 $$= NEW_PTN Item_func_ascii(@$, $3);
10991 }
10992 | CHARSET '(' expr ')'
10993 {
10994
2/4
✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
423 $$= NEW_PTN Item_func_charset(@$, $3);
10995 }
10996 | COALESCE '(' expr_list ')'
10997 {
10998
2/4
✓ Branch 0 taken 1746999 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1746999 times.
✗ Branch 3 not taken.
1746999 $$= NEW_PTN Item_func_coalesce(@$, $3);
10999 }
11000 | COLLATION_SYM '(' expr ')'
11001 {
11002
2/4
✓ Branch 0 taken 1257 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1257 times.
✗ Branch 3 not taken.
1257 $$= NEW_PTN Item_func_collation(@$, $3);
11003 }
11004 | DATABASE '(' ')'
11005 {
11006
2/4
✓ Branch 0 taken 10893 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10894 times.
✗ Branch 3 not taken.
10893 $$= NEW_PTN Item_func_database(@$);
11007 }
11008 | IF '(' expr ',' expr ',' expr ')'
11009 {
11010
2/4
✓ Branch 0 taken 5515114 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5515114 times.
✗ Branch 3 not taken.
5515114 $$= NEW_PTN Item_func_if(@$, $3,$5,$7);
11011 }
11012 | FORMAT_SYM '(' expr ',' expr ')'
11013 {
11014
2/4
✓ Branch 0 taken 213 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 213 times.
✗ Branch 3 not taken.
213 $$= NEW_PTN Item_func_format(@$, $3, $5);
11015 }
11016 | FORMAT_SYM '(' expr ',' expr ',' expr ')'
11017 {
11018
2/4
✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 61 times.
✗ Branch 3 not taken.
61 $$= NEW_PTN Item_func_format(@$, $3, $5, $7);
11019 }
11020 | MICROSECOND_SYM '(' expr ')'
11021 {
11022
2/4
✓ Branch 0 taken 127 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 127 times.
✗ Branch 3 not taken.
127 $$= NEW_PTN Item_func_microsecond(@$, $3);
11023 }
11024 | MOD_SYM '(' expr ',' expr ')'
11025 {
11026
2/4
✓ Branch 0 taken 12200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12200 times.
✗ Branch 3 not taken.
12200 $$= NEW_PTN Item_func_mod(@$, $3, $5);
11027 }
11028 | QUARTER_SYM '(' expr ')'
11029 {
11030
2/4
✓ Branch 0 taken 127 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 127 times.
✗ Branch 3 not taken.
127 $$= NEW_PTN Item_func_quarter(@$, $3);
11031 }
11032 | REPEAT_SYM '(' expr ',' expr ')'
11033 {
11034
2/4
✓ Branch 0 taken 612875 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 612889 times.
✗ Branch 3 not taken.
612871 $$= NEW_PTN Item_func_repeat(@$, $3,$5);
11035 }
11036 | REPLACE_SYM '(' expr ',' expr ',' expr ')'
11037 {
11038
2/4
✓ Branch 0 taken 253154 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 253154 times.
✗ Branch 3 not taken.
253154 $$= NEW_PTN Item_func_replace(@$, $3,$5,$7);
11039 }
11040 | REVERSE_SYM '(' expr ')'
11041 {
11042
2/4
✓ Branch 0 taken 3016 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3016 times.
✗ Branch 3 not taken.
3016 $$= NEW_PTN Item_func_reverse(@$, $3);
11043 }
11044 | ROW_COUNT_SYM '(' ')'
11045 {
11046
2/4
✓ Branch 0 taken 4578 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4578 times.
✗ Branch 3 not taken.
4578 $$= NEW_PTN Item_func_row_count(@$);
11047 }
11048 | TRUNCATE_SYM '(' expr ',' expr ')'
11049 {
11050
2/4
✓ Branch 0 taken 103 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 103 times.
✗ Branch 3 not taken.
103 $$= NEW_PTN Item_func_round(@$, $3,$5,1);
11051 }
11052 | WEEK_SYM '(' expr ')'
11053 {
11054
2/4
✓ Branch 0 taken 89 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 89 times.
✗ Branch 3 not taken.
89 $$= NEW_PTN Item_func_week(@$, $3, NULL);
11055 }
11056 | WEEK_SYM '(' expr ',' expr ')'
11057 {
11058
2/4
✓ Branch 0 taken 94 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 94 times.
✗ Branch 3 not taken.
94 $$= NEW_PTN Item_func_week(@$, $3, $5);
11059 }
11060 | WEIGHT_STRING_SYM '(' expr ')'
11061 {
11062
2/4
✓ Branch 0 taken 610 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 610 times.
✗ Branch 3 not taken.
610 $$= NEW_PTN Item_func_weight_string(@$, $3, 0, 0, 0);
11063 }
11064 | WEIGHT_STRING_SYM '(' expr AS CHAR_SYM ws_num_codepoints ')'
11065 {
11066
2/4
✓ Branch 0 taken 568 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 568 times.
✗ Branch 3 not taken.
568 $$= NEW_PTN Item_func_weight_string(@$, $3, 0, $6, 0);
11067 }
11068 | WEIGHT_STRING_SYM '(' expr AS BINARY_SYM ws_num_codepoints ')'
11069 {
11070
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 $$= NEW_PTN Item_func_weight_string(@$, $3, 0, $6, 0, true);
11071 }
11072 | WEIGHT_STRING_SYM '(' expr ',' ulong_num ',' ulong_num ',' ulong_num ')'
11073 {
11074
2/4
✓ Branch 0 taken 2072 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2072 times.
✗ Branch 3 not taken.
2072 $$= NEW_PTN Item_func_weight_string(@$, $3, $5, $7, $9);
11075 }
11076 | geometry_function
11077 ;
11078
11079 geometry_function:
11080 GEOMETRYCOLLECTION_SYM '(' opt_expr_list ')'
11081 {
11082
1/2
✓ Branch 0 taken 253 times.
✗ Branch 1 not taken.
506 $$= NEW_PTN Item_func_spatial_collection(@$, $3,
11083 Geometry::wkb_geometrycollection,
11084
1/2
✓ Branch 0 taken 253 times.
✗ Branch 1 not taken.
506 Geometry::wkb_point);
11085 }
11086 | LINESTRING_SYM '(' expr_list ')'
11087 {
11088
1/2
✓ Branch 0 taken 1311 times.
✗ Branch 1 not taken.
2622 $$= NEW_PTN Item_func_spatial_collection(@$, $3,
11089 Geometry::wkb_linestring,
11090
1/2
✓ Branch 0 taken 1311 times.
✗ Branch 1 not taken.
2622 Geometry::wkb_point);
11091 }
11092 | MULTILINESTRING_SYM '(' expr_list ')'
11093 {
11094
1/2
✓ Branch 0 taken 104 times.
✗ Branch 1 not taken.
208 $$= NEW_PTN Item_func_spatial_collection(@$, $3,
11095 Geometry::wkb_multilinestring,
11096
1/2
✓ Branch 0 taken 104 times.
✗ Branch 1 not taken.
208 Geometry::wkb_linestring);
11097 }
11098 | MULTIPOINT_SYM '(' expr_list ')'
11099 {
11100
1/2
✓ Branch 0 taken 101 times.
✗ Branch 1 not taken.
202 $$= NEW_PTN Item_func_spatial_collection(@$, $3,
11101 Geometry::wkb_multipoint,
11102
1/2
✓ Branch 0 taken 101 times.
✗ Branch 1 not taken.
202 Geometry::wkb_point);
11103 }
11104 | MULTIPOLYGON_SYM '(' expr_list ')'
11105 {
11106
1/2
✓ Branch 0 taken 128 times.
✗ Branch 1 not taken.
256 $$= NEW_PTN Item_func_spatial_collection(@$, $3,
11107 Geometry::wkb_multipolygon,
11108
1/2
✓ Branch 0 taken 128 times.
✗ Branch 1 not taken.
256 Geometry::wkb_polygon);
11109 }
11110 | POINT_SYM '(' expr ',' expr ')'
11111 {
11112
2/4
✓ Branch 0 taken 5694 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5694 times.
✗ Branch 3 not taken.
5694 $$= NEW_PTN Item_func_point(@$, $3,$5);
11113 }
11114 | POLYGON_SYM '(' expr_list ')'
11115 {
11116
1/2
✓ Branch 0 taken 426 times.
✗ Branch 1 not taken.
852 $$= NEW_PTN Item_func_spatial_collection(@$, $3,
11117 Geometry::wkb_polygon,
11118
1/2
✓ Branch 0 taken 426 times.
✗ Branch 1 not taken.
852 Geometry::wkb_linestring);
11119 }
11120 ;
11121
11122 /*
11123 Regular function calls.
11124 The function name is *not* a token, and therefore is guaranteed to not
11125 introduce side effects to the language in general.
11126 MAINTAINER:
11127 All the new functions implemented for new features should fit into
11128 this category. The place to implement the function itself is
11129 in sql/item_create.cc
11130 */
11131 function_call_generic:
11132 IDENT_sys '(' opt_udf_expr_list ')'
11133 {
11134
2/4
✓ Branch 0 taken 7036149 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7036166 times.
✗ Branch 3 not taken.
7036144 $$= NEW_PTN PTI_function_call_generic_ident_sys(@1, $1, $3);
11135 }
11136 | ident '.' ident '(' opt_expr_list ')'
11137 {
11138
2/4
✓ Branch 0 taken 106352 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 106352 times.
✗ Branch 3 not taken.
106352 $$= NEW_PTN PTI_function_call_generic_2d(@$, $1, $3, $5);
11139 }
11140 ;
11141
11142 fulltext_options:
11143 opt_natural_language_mode opt_query_expansion
11144 1293 { $$= $1 | $2; }
11145 | IN_SYM BOOLEAN_SYM MODE_SYM
11146 {
11147 1465 $$= FT_BOOL;
11148
6/8
✓ Branch 0 taken 1465 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 1462 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
1465 DBUG_EXECUTE_IF("simulate_bug18831513",
11149 {
11150 THD *thd= YYTHD;
11151 if (thd->sp_runtime_ctx)
11152 YYTHD->syntax_error();
11153 });
11154 }
11155 ;
11156
11157 opt_natural_language_mode:
11158 1115 /* nothing */ { $$= FT_NL; }
11159 178 | IN_SYM NATURAL LANGUAGE_SYM MODE_SYM { $$= FT_NL; }
11160 ;
11161
11162 opt_query_expansion:
11163 1161 /* nothing */ { $$= 0; }
11164 132 | WITH QUERY_SYM EXPANSION_SYM { $$= FT_EXPAND; }
11165 ;
11166
11167 opt_udf_expr_list:
11168 251025 /* empty */ { $$= NULL; }
11169 6785305 | udf_expr_list { $$= $1; }
11170 ;
11171
11172 udf_expr_list:
11173 udf_expr
11174 {
11175
2/4
✓ Branch 0 taken 6785325 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6785334 times.
✗ Branch 3 not taken.
6785330 $$= NEW_PTN PT_item_list;
11176
4/8
✓ Branch 0 taken 6785337 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6785336 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 6785336 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 6785333 times.
6785334 if ($$ == NULL || $$->push_back($1))
11177 MYSQL_YYABORT;
11178 }
11179 | udf_expr_list ',' udf_expr
11180 {
11181
4/8
✓ Branch 0 taken 14732049 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14732049 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 14732049 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 14732049 times.
14732049 if ($1 == NULL || $1->push_back($3))
11182 MYSQL_YYABORT;
11183 14732049 $$= $1;
11184 }
11185 ;
11186
11187 udf_expr:
11188 expr select_alias
11189 {
11190
2/4
✓ Branch 0 taken 21517374 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21517385 times.
✗ Branch 3 not taken.
21517378 $$= NEW_PTN PTI_udf_expr(@$, $1, $2, @1.cpp);
11191 }
11192 ;
11193
11194 set_function_specification:
11195 sum_expr
11196 | grouping_operation
11197 ;
11198
11199 sum_expr:
11200 AVG_SYM '(' in_sum_expr ')' opt_windowing_clause
11201 {
11202
2/4
✓ Branch 0 taken 3615 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3615 times.
✗ Branch 3 not taken.
3615 $$= NEW_PTN Item_sum_avg(@$, $3, false, $5);
11203 }
11204 | AVG_SYM '(' DISTINCT in_sum_expr ')' opt_windowing_clause
11205 {
11206
2/4
✓ Branch 0 taken 114 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 114 times.
✗ Branch 3 not taken.
114 $$= NEW_PTN Item_sum_avg(@$, $4, true, $6);
11207 }
11208 | BIT_AND_SYM '(' in_sum_expr ')' opt_windowing_clause
11209 {
11210
2/4
✓ Branch 0 taken 173 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 173 times.
✗ Branch 3 not taken.
173 $$= NEW_PTN Item_sum_and(@$, $3, $5);
11211 }
11212 | BIT_OR_SYM '(' in_sum_expr ')' opt_windowing_clause
11213 {
11214
2/4
✓ Branch 0 taken 204 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 204 times.
✗ Branch 3 not taken.
204 $$= NEW_PTN Item_sum_or(@$, $3, $5);
11215 }
11216 | JSON_ARRAYAGG '(' in_sum_expr ')' opt_windowing_clause
11217 {
11218 176 auto wrapper = make_unique_destroy_only<Json_wrapper>(YYMEM_ROOT);
11219
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 176 times.
176 if (wrapper == nullptr) YYABORT;
11220 unique_ptr_destroy_only<Json_array> array{::new (YYMEM_ROOT)
11221
2/4
✓ Branch 0 taken 176 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 176 times.
✗ Branch 3 not taken.
176 Json_array};
11222
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 176 times.
176 if (array == nullptr) YYABORT;
11223
1/2
✓ Branch 0 taken 176 times.
✗ Branch 1 not taken.
704 $$ = NEW_PTN Item_sum_json_array(@$, $3, $5, std::move(wrapper),
11224
1/2
✓ Branch 0 taken 176 times.
✗ Branch 1 not taken.
528 std::move(array));
11225
2/4
✓ Branch 0 taken 176 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 176 times.
✗ Branch 3 not taken.
176 }
11226 | JSON_OBJECTAGG '(' in_sum_expr ',' in_sum_expr ')' opt_windowing_clause
11227 {
11228 150 auto wrapper = make_unique_destroy_only<Json_wrapper>(YYMEM_ROOT);
11229
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 150 times.
150 if (wrapper == nullptr) YYABORT;
11230 unique_ptr_destroy_only<Json_object> object{::new (YYMEM_ROOT)
11231
2/4
✓ Branch 0 taken 150 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 150 times.
✗ Branch 3 not taken.
150 Json_object};
11232
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 150 times.
150 if (object == nullptr) YYABORT;
11233
1/2
✓ Branch 0 taken 150 times.
✗ Branch 1 not taken.
600 $$ = NEW_PTN Item_sum_json_object(
11234
1/2
✓ Branch 0 taken 150 times.
✗ Branch 1 not taken.
600 @$, $3, $5, $7, std::move(wrapper), std::move(object));
11235
2/4
✓ Branch 0 taken 150 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 150 times.
✗ Branch 3 not taken.
150 }
11236 | ST_COLLECT_SYM '(' in_sum_expr ')' opt_windowing_clause
11237 {
11238
2/4
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
✗ Branch 3 not taken.
17 $$= NEW_PTN Item_sum_collect(@$, $3, $5, false);
11239 }
11240 | ST_COLLECT_SYM '(' DISTINCT in_sum_expr ')' opt_windowing_clause
11241 {
11242
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
6 $$= NEW_PTN Item_sum_collect(@$, $4, $6, true );
11243 }
11244 | BIT_XOR_SYM '(' in_sum_expr ')' opt_windowing_clause
11245 {
11246
2/4
✓ Branch 0 taken 113 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 113 times.
✗ Branch 3 not taken.
113 $$= NEW_PTN Item_sum_xor(@$, $3, $5);
11247 }
11248 | COUNT_SYM '(' opt_all '*' ')' opt_windowing_clause
11249 {
11250
2/4
✓ Branch 0 taken 329296 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 329297 times.
✗ Branch 3 not taken.
329296 $$= NEW_PTN PTI_count_sym(@$, $6);
11251 }
11252 | COUNT_SYM '(' in_sum_expr ')' opt_windowing_clause
11253 {
11254
2/4
✓ Branch 0 taken 132945 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 132945 times.
✗ Branch 3 not taken.
132945 $$= NEW_PTN Item_sum_count(@$, $3, $5);
11255 }
11256 | COUNT_SYM '(' DISTINCT expr_list ')' opt_windowing_clause
11257 {
11258
2/4
✓ Branch 0 taken 35529 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35529 times.
✗ Branch 3 not taken.
35529 $$= new Item_sum_count(@$, $4, $6);
11259 }
11260 | MIN_SYM '(' in_sum_expr ')' opt_windowing_clause
11261 {
11262
2/4
✓ Branch 0 taken 14784 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14784 times.
✗ Branch 3 not taken.
14784 $$= NEW_PTN Item_sum_min(@$, $3, $5);
11263 }
11264 /*
11265 According to ANSI SQL, DISTINCT is allowed and has
11266 no sense inside MIN and MAX grouping functions; so MIN|MAX(DISTINCT ...)
11267 is processed like an ordinary MIN | MAX()
11268 */
11269 | MIN_SYM '(' DISTINCT in_sum_expr ')' opt_windowing_clause
11270 {
11271 $$= NEW_PTN Item_sum_min(@$, $4, $6);
11272 }
11273 | MAX_SYM '(' in_sum_expr ')' opt_windowing_clause
11274 {
11275
2/4
✓ Branch 0 taken 38653 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38653 times.
✗ Branch 3 not taken.
38653 $$= NEW_PTN Item_sum_max(@$, $3, $5);
11276 }
11277 | MAX_SYM '(' DISTINCT in_sum_expr ')' opt_windowing_clause
11278 {
11279 $$= NEW_PTN Item_sum_max(@$, $4, $6);
11280 }
11281 | STD_SYM '(' in_sum_expr ')' opt_windowing_clause
11282 {
11283
2/4
✓ Branch 0 taken 377 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 377 times.
✗ Branch 3 not taken.
377 $$= NEW_PTN Item_sum_std(@$, $3, 0, $5);
11284 }
11285 | VARIANCE_SYM '(' in_sum_expr ')' opt_windowing_clause
11286 {
11287
2/4
✓ Branch 0 taken 268 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 268 times.
✗ Branch 3 not taken.
268 $$= NEW_PTN Item_sum_variance(@$, $3, 0, $5);
11288 }
11289 | STDDEV_SAMP_SYM '(' in_sum_expr ')' opt_windowing_clause
11290 {
11291
2/4
✓ Branch 0 taken 41 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 41 times.
✗ Branch 3 not taken.
41 $$= NEW_PTN Item_sum_std(@$, $3, 1, $5);
11292 }
11293 | VAR_SAMP_SYM '(' in_sum_expr ')' opt_windowing_clause
11294 {
11295
2/4
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
✗ Branch 3 not taken.
52 $$= NEW_PTN Item_sum_variance(@$, $3, 1, $5);
11296 }
11297 | SUM_SYM '(' in_sum_expr ')' opt_windowing_clause
11298 {
11299
2/4
✓ Branch 0 taken 527103 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 527103 times.
✗ Branch 3 not taken.
527103 $$= NEW_PTN Item_sum_sum(@$, $3, false, $5);
11300 }
11301 | SUM_SYM '(' DISTINCT in_sum_expr ')' opt_windowing_clause
11302 {
11303
2/4
✓ Branch 0 taken 307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 307 times.
✗ Branch 3 not taken.
307 $$= NEW_PTN Item_sum_sum(@$, $4, true, $6);
11304 }
11305 | GROUP_CONCAT_SYM '(' opt_distinct
11306 expr_list opt_gorder_clause
11307 opt_gconcat_separator
11308 ')' opt_windowing_clause
11309 {
11310
2/4
✓ Branch 0 taken 21233 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21233 times.
✗ Branch 3 not taken.
21233 $$= NEW_PTN Item_func_group_concat(@$, $3, $4, $5, $6, $8);
11311 }
11312 ;
11313
11314 window_func_call: // Window functions which do not exist as set functions
11315 ROW_NUMBER_SYM '(' ')' windowing_clause
11316 {
11317
2/4
✓ Branch 0 taken 260 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 260 times.
✗ Branch 3 not taken.
260 $$= NEW_PTN Item_row_number(@$, $4);
11318 }
11319 | RANK_SYM '(' ')' windowing_clause
11320 {
11321
2/4
✓ Branch 0 taken 352 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 352 times.
✗ Branch 3 not taken.
352 $$= NEW_PTN Item_rank(@$, false, $4);
11322 }
11323 | DENSE_RANK_SYM '(' ')' windowing_clause
11324 {
11325
2/4
✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
✗ Branch 3 not taken.
49 $$= NEW_PTN Item_rank(@$, true, $4);
11326 }
11327 | CUME_DIST_SYM '(' ')' windowing_clause
11328 {
11329
2/4
✓ Branch 0 taken 112 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
✗ Branch 3 not taken.
112 $$= NEW_PTN Item_cume_dist(@$, $4);
11330 }
11331 | PERCENT_RANK_SYM '(' ')' windowing_clause
11332 {
11333
2/4
✓ Branch 0 taken 103 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 103 times.
✗ Branch 3 not taken.
103 $$= NEW_PTN Item_percent_rank(@$, $4);
11334 }
11335 | NTILE_SYM '(' stable_integer ')' windowing_clause
11336 {
11337
2/4
✓ Branch 0 taken 130 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 130 times.
✗ Branch 3 not taken.
130 $$=NEW_PTN Item_ntile(@$, $3, $5);
11338 }
11339 | LEAD_SYM '(' expr opt_lead_lag_info ')' opt_null_treatment windowing_clause
11340 {
11341
2/4
✓ Branch 0 taken 407 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 407 times.
✗ Branch 3 not taken.
407 PT_item_list *args= NEW_PTN PT_item_list;
11342
4/8
✓ Branch 0 taken 407 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 407 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 407 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 407 times.
407 if (args == NULL || args->push_back($3))
11343 MYSQL_YYABORT; // OOM
11344
5/8
✓ Branch 0 taken 394 times.
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 394 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 394 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 407 times.
407 if ($4.offset != NULL && args->push_back($4.offset))
11345 MYSQL_YYABORT; // OOM
11346
5/8
✓ Branch 0 taken 162 times.
✓ Branch 1 taken 245 times.
✓ Branch 2 taken 162 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 162 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 407 times.
407 if ($4.default_value != NULL && args->push_back($4.default_value))
11347 MYSQL_YYABORT; // OOM
11348
2/4
✓ Branch 0 taken 407 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 407 times.
✗ Branch 3 not taken.
407 $$= NEW_PTN Item_lead_lag(@$, true, args, $6, $7);
11349 }
11350 | LAG_SYM '(' expr opt_lead_lag_info ')' opt_null_treatment windowing_clause
11351 {
11352
2/4
✓ Branch 0 taken 220 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 220 times.
✗ Branch 3 not taken.
220 PT_item_list *args= NEW_PTN PT_item_list;
11353
4/8
✓ Branch 0 taken 220 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 220 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 220 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 220 times.
220 if (args == NULL || args->push_back($3))
11354 MYSQL_YYABORT; // OOM
11355
5/8
✓ Branch 0 taken 206 times.
✓ Branch 1 taken 14 times.
✓ Branch 2 taken 206 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 206 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 220 times.
220 if ($4.offset != NULL && args->push_back($4.offset))
11356 MYSQL_YYABORT; // OOM
11357
5/8
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 182 times.
✓ Branch 2 taken 38 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 38 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 220 times.
220 if ($4.default_value != NULL && args->push_back($4.default_value))
11358 MYSQL_YYABORT; // OOM
11359
2/4
✓ Branch 0 taken 220 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 220 times.
✗ Branch 3 not taken.
220 $$= NEW_PTN Item_lead_lag(@$, false, args, $6, $7);
11360 }
11361 | FIRST_VALUE_SYM '(' expr ')' opt_null_treatment windowing_clause
11362 {
11363
2/4
✓ Branch 0 taken 361 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 361 times.
✗ Branch 3 not taken.
361 $$= NEW_PTN Item_first_last_value(@$, true, $3, $5, $6);
11364 }
11365 | LAST_VALUE_SYM '(' expr ')' opt_null_treatment windowing_clause
11366 {
11367
2/4
✓ Branch 0 taken 131 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 131 times.
✗ Branch 3 not taken.
131 $$= NEW_PTN Item_first_last_value(@$, false, $3, $5, $6);
11368 }
11369 | NTH_VALUE_SYM '(' expr ',' simple_expr ')' opt_from_first_last opt_null_treatment windowing_clause
11370 {
11371
2/4
✓ Branch 0 taken 232 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 232 times.
✗ Branch 3 not taken.
232 PT_item_list *args= NEW_PTN PT_item_list;
11372 464 if (args == NULL ||
11373
4/8
✓ Branch 0 taken 232 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 232 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 232 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 232 times.
464 args->push_back($3) ||
11374
2/4
✓ Branch 0 taken 232 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 232 times.
232 args->push_back($5))
11375 MYSQL_YYABORT;
11376
2/4
✓ Branch 0 taken 232 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 232 times.
✗ Branch 3 not taken.
232 $$= NEW_PTN Item_nth_value(@$, args, $7 == NFL_FROM_LAST, $8, $9);
11377 }
11378 ;
11379
11380 opt_lead_lag_info:
11381 /* Nothing */
11382 {
11383 27 $$.offset= NULL;
11384 27 $$.default_value= NULL;
11385 }
11386 | ',' stable_integer opt_ll_default
11387 {
11388 600 $$.offset= $2;
11389 600 $$.default_value= $3;
11390 }
11391 ;
11392
11393 /*
11394 The stable_integer nonterminal symbol is not really constant, but constant
11395 for the duration of an execution.
11396 */
11397 stable_integer:
11398 695 int64_literal { $$ = $1; }
11399 | param_or_var
11400 ;
11401
11402 param_or_var:
11403 12 param_marker { $$ = $1; }
11404
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
6 | ident { $$ = NEW_PTN PTI_int_splocal(@$, to_lex_cstring($1)); }
11405
2/4
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
✗ Branch 3 not taken.
17 | '@' ident_or_text { $$ = NEW_PTN PTI_user_variable(@$, $2); }
11406 ;
11407
11408 opt_ll_default:
11409 /* Nothing */
11410 {
11411 400 $$= NULL;
11412 }
11413 | ',' expr
11414 {
11415 200 $$= $2;
11416 }
11417 ;
11418
11419 opt_null_treatment:
11420 /* Nothing */
11421 {
11422 1315 $$= NT_NONE;
11423 }
11424 | RESPECT_SYM NULLS_SYM
11425 {
11426 33 $$= NT_RESPECT_NULLS;
11427 }
11428 | IGNORE_SYM NULLS_SYM
11429 {
11430 3 $$= NT_IGNORE_NULLS;
11431 }
11432 ;
11433
11434
11435 opt_from_first_last:
11436 /* Nothing */
11437 {
11438 230 $$= NFL_NONE;
11439 }
11440 | FROM FIRST_SYM
11441 {
11442 1 $$= NFL_FROM_FIRST;
11443 }
11444 | FROM LAST_SYM
11445 {
11446 1 $$= NFL_FROM_LAST;
11447 }
11448 ;
11449
11450 opt_windowing_clause:
11451 /* Nothing */
11452 {
11453 1103035 $$= NULL;
11454 }
11455 | windowing_clause
11456 {
11457 2122 $$= $1;
11458 }
11459 ;
11460
11461 windowing_clause:
11462 OVER_SYM window_name_or_spec
11463 {
11464 4479 $$= $2;
11465 }
11466 ;
11467
11468 window_name_or_spec:
11469 window_name
11470 {
11471
2/4
✓ Branch 0 taken 2076 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2076 times.
✗ Branch 3 not taken.
2076 $$= NEW_PTN PT_window($1);
11472 }
11473 | window_spec
11474 {
11475 2403 $$= $1;
11476 }
11477 ;
11478
11479 window_name:
11480 ident
11481 {
11482
2/4
✓ Branch 0 taken 3128 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3128 times.
✗ Branch 3 not taken.
3128 $$= NEW_PTN Item_string($1.str, $1.length, YYTHD->charset());
11483 }
11484 ;
11485
11486 window_spec:
11487 '(' window_spec_details ')'
11488 {
11489 3399 $$= $2;
11490 }
11491 ;
11492
11493 window_spec_details:
11494 opt_existing_window_name
11495 opt_partition_clause
11496 opt_window_order_by_clause
11497 opt_window_frame_clause
11498 {
11499 3399 auto frame= $4;
11500
2/2
✓ Branch 0 taken 2020 times.
✓ Branch 1 taken 1379 times.
3399 if (!frame) // build an equivalent frame spec
11501 {
11502
2/4
✓ Branch 0 taken 2020 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2020 times.
✗ Branch 3 not taken.
2020 auto start_bound= NEW_PTN PT_border(WBT_UNBOUNDED_PRECEDING);
11503 2020 auto end_bound= NEW_PTN PT_border($3 ? WBT_CURRENT_ROW :
11504
4/6
✓ Branch 0 taken 2020 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 965 times.
✓ Branch 3 taken 1055 times.
✓ Branch 4 taken 2020 times.
✗ Branch 5 not taken.
2020 WBT_UNBOUNDED_FOLLOWING);
11505
2/4
✓ Branch 0 taken 2020 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2020 times.
✗ Branch 3 not taken.
2020 auto bounds= NEW_PTN PT_borders(start_bound, end_bound);
11506
2/4
✓ Branch 0 taken 2020 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2020 times.
✗ Branch 3 not taken.
2020 frame= NEW_PTN PT_frame(WFU_RANGE, bounds, nullptr);
11507 2020 frame->m_originally_absent= true;
11508 }
11509
2/4
✓ Branch 0 taken 3399 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3399 times.
✗ Branch 3 not taken.
3399 $$= NEW_PTN PT_window($2, $3, frame, $1);
11510 }
11511 ;
11512
11513 opt_existing_window_name:
11514 /* Nothing */
11515 {
11516 3352 $$= NULL;
11517 }
11518 | window_name
11519 {
11520 55 $$= $1;
11521 }
11522 ;
11523
11524 opt_partition_clause:
11525 /* Nothing */
11526 {
11527 2777 $$= NULL;
11528 }
11529 | PARTITION_SYM BY group_list
11530 {
11531 630 $$= $3;
11532 }
11533 ;
11534
11535 opt_window_order_by_clause:
11536 /* Nothing */
11537 {
11538 1352 $$= NULL;
11539 }
11540 | ORDER_SYM BY order_list
11541 {
11542 2055 $$= $3;
11543 }
11544 ;
11545
11546 opt_window_frame_clause:
11547 /* Nothing*/
11548 {
11549 2020 $$= NULL;
11550 }
11551 | window_frame_units
11552 window_frame_extent
11553 opt_window_frame_exclusion
11554 {
11555
2/4
✓ Branch 0 taken 1379 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1379 times.
✗ Branch 3 not taken.
1379 $$= NEW_PTN PT_frame($1, $2, $3);
11556 }
11557 ;
11558
11559 window_frame_extent:
11560 window_frame_start
11561 {
11562
2/4
✓ Branch 0 taken 617 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 617 times.
✗ Branch 3 not taken.
617 auto end_bound= NEW_PTN PT_border(WBT_CURRENT_ROW);
11563
2/4
✓ Branch 0 taken 617 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 617 times.
✗ Branch 3 not taken.
617 $$= NEW_PTN PT_borders($1, end_bound);
11564 }
11565 | window_frame_between
11566 {
11567 762 $$= $1;
11568 }
11569 ;
11570
11571 window_frame_start:
11572 UNBOUNDED_SYM PRECEDING_SYM
11573 {
11574
2/4
✓ Branch 0 taken 552 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 552 times.
✗ Branch 3 not taken.
552 $$= NEW_PTN PT_border(WBT_UNBOUNDED_PRECEDING);
11575 }
11576 | NUM_literal PRECEDING_SYM
11577 {
11578
2/4
✓ Branch 0 taken 548 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 548 times.
✗ Branch 3 not taken.
548 $$= NEW_PTN PT_border(WBT_VALUE_PRECEDING, $1);
11579 }
11580 | param_marker PRECEDING_SYM
11581 {
11582
2/4
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
7 $$= NEW_PTN PT_border(WBT_VALUE_PRECEDING, $1);
11583 }
11584 | INTERVAL_SYM expr interval PRECEDING_SYM
11585 {
11586
2/4
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 80 times.
✗ Branch 3 not taken.
80 $$= NEW_PTN PT_border(WBT_VALUE_PRECEDING, $2, $3);
11587 }
11588 | CURRENT_SYM ROW_SYM
11589 {
11590
2/4
✓ Branch 0 taken 283 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 283 times.
✗ Branch 3 not taken.
283 $$= NEW_PTN PT_border(WBT_CURRENT_ROW);
11591 }
11592 ;
11593
11594 window_frame_between:
11595 BETWEEN_SYM window_frame_bound AND_SYM window_frame_bound
11596 {
11597
2/4
✓ Branch 0 taken 762 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 762 times.
✗ Branch 3 not taken.
762 $$= NEW_PTN PT_borders($2, $4);
11598 }
11599 ;
11600
11601 window_frame_bound:
11602 window_frame_start
11603 {
11604 853 $$= $1;
11605 }
11606 | UNBOUNDED_SYM FOLLOWING_SYM
11607 {
11608
2/4
✓ Branch 0 taken 181 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 181 times.
✗ Branch 3 not taken.
181 $$= NEW_PTN PT_border(WBT_UNBOUNDED_FOLLOWING);
11609 }
11610 | NUM_literal FOLLOWING_SYM
11611 {
11612
2/4
✓ Branch 0 taken 439 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 439 times.
✗ Branch 3 not taken.
439 $$= NEW_PTN PT_border(WBT_VALUE_FOLLOWING, $1);
11613 }
11614 | param_marker FOLLOWING_SYM
11615 {
11616
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 $$= NEW_PTN PT_border(WBT_VALUE_FOLLOWING, $1);
11617 }
11618 | INTERVAL_SYM expr interval FOLLOWING_SYM
11619 {
11620
2/4
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48 times.
✗ Branch 3 not taken.
48 $$= NEW_PTN PT_border(WBT_VALUE_FOLLOWING, $2, $3);
11621 }
11622 ;
11623
11624 opt_window_frame_exclusion:
11625 /* Nothing */
11626 {
11627 1375 $$= NULL;
11628 }
11629 | EXCLUDE_SYM CURRENT_SYM ROW_SYM
11630 {
11631
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 $$= NEW_PTN PT_exclusion(WFX_CURRENT_ROW);
11632 }
11633 | EXCLUDE_SYM GROUP_SYM
11634 {
11635
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 $$= NEW_PTN PT_exclusion(WFX_GROUP);
11636 }
11637 | EXCLUDE_SYM TIES_SYM
11638 {
11639
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 $$= NEW_PTN PT_exclusion(WFX_TIES);
11640 }
11641 | EXCLUDE_SYM NO_SYM OTHERS_SYM
11642
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 { $$= NEW_PTN PT_exclusion(WFX_NO_OTHERS);
11643 }
11644 ;
11645
11646 window_frame_units:
11647 892 ROWS_SYM { $$= WFU_ROWS; }
11648 494 | RANGE_SYM { $$= WFU_RANGE; }
11649 1 | GROUPS_SYM { $$= WFU_GROUPS; }
11650 ;
11651
11652 grouping_operation:
11653 GROUPING_SYM '(' expr_list ')'
11654 {
11655
2/4
✓ Branch 0 taken 124 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 124 times.
✗ Branch 3 not taken.
124 $$= NEW_PTN Item_func_grouping(@$, $3);
11656 }
11657 ;
11658
11659 in_expression_user_variable_assignment:
11660 '@' ident_or_text SET_VAR expr
11661 {
11662
2/4
✓ Branch 0 taken 39347 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39347 times.
✗ Branch 3 not taken.
39347 push_warning(YYTHD, Sql_condition::SL_WARNING,
11663 ER_WARN_DEPRECATED_SYNTAX,
11664 ER_THD(YYTHD, ER_WARN_DEPRECATED_USER_SET_EXPR));
11665
2/4
✓ Branch 0 taken 39347 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39347 times.
✗ Branch 3 not taken.
39347 $$ = NEW_PTN PTI_variable_aux_set_var(@$, $2, $4);
11666 }
11667 ;
11668
11669 rvalue_system_or_user_variable:
11670 '@' ident_or_text
11671 {
11672
2/4
✓ Branch 0 taken 1033840 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1033842 times.
✗ Branch 3 not taken.
1033840 $$ = NEW_PTN PTI_user_variable(@$, $2);
11673 }
11674 | '@' '@' opt_rvalue_system_variable_type rvalue_system_variable
11675 {
11676
1/2
✓ Branch 0 taken 576687 times.
✗ Branch 1 not taken.
1153376 $$ = NEW_PTN PTI_get_system_variable(@$, $3,
11677
1/2
✓ Branch 0 taken 576689 times.
✗ Branch 1 not taken.
1153374 @4, $4.prefix, $4.name);
11678 }
11679 ;
11680
11681 opt_distinct:
11682 21145 /* empty */ { $$ = 0; }
11683 90 | DISTINCT { $$ = 1; }
11684 ;
11685
11686 opt_gconcat_separator:
11687 /* empty */
11688 {
11689
1/2
✓ Branch 0 taken 3910 times.
✗ Branch 1 not taken.
3910 $$= NEW_PTN String(",", 1, &my_charset_latin1);
11690
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3910 times.
3910 if ($$ == NULL)
11691 MYSQL_YYABORT;
11692 }
11693 17323 | SEPARATOR_SYM text_string { $$ = $2; }
11694 ;
11695
11696 opt_gorder_clause:
11697 2194 /* empty */ { $$= NULL; }
11698 19040 | ORDER_SYM BY gorder_list { $$= $3; }
11699 ;
11700
11701 gorder_list:
11702 gorder_list ',' order_expr
11703 {
11704
1/2
✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
45 $1->push_back($3);
11705 45 $$= $1;
11706 }
11707 | order_expr
11708 {
11709
1/2
✓ Branch 0 taken 19041 times.
✗ Branch 1 not taken.
38082 $$= NEW_PTN PT_gorder_list();
11710
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 19041 times.
19041 if ($$ == NULL)
11711 MYSQL_YYABORT;
11712
1/2
✓ Branch 0 taken 19041 times.
✗ Branch 1 not taken.
19041 $$->push_back($1);
11713 }
11714 ;
11715
11716 in_sum_expr:
11717 opt_all expr
11718 {
11719
2/4
✓ Branch 0 taken 719253 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 719253 times.
✗ Branch 3 not taken.
719253 $$= NEW_PTN PTI_in_sum_expr(@1, $2);
11720 }
11721 ;
11722
11723 cast_type:
11724 BINARY_SYM opt_field_length
11725 {
11726 1301 $$.target= ITEM_CAST_CHAR;
11727 1301 $$.charset= &my_charset_bin;
11728 1301 $$.length= $2;
11729 1301 $$.dec= NULL;
11730 }
11731 | CHAR_SYM opt_field_length opt_charset_with_opt_binary
11732 {
11733 87783 $$.target= ITEM_CAST_CHAR;
11734 87783 $$.length= $2;
11735 87783 $$.dec= NULL;
11736
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 87779 times.
87783 if ($3.force_binary)
11737 {
11738 // Bugfix: before this patch we ignored [undocumented]
11739 // collation modifier in the CAST(expr, CHAR(...) BINARY) syntax.
11740 // To restore old behavior just remove this "if ($3...)" branch.
11741
11742
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 $$.charset= get_bin_collation($3.charset ? $3.charset :
11743 YYTHD->variables.collation_connection);
11744
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 if ($$.charset == NULL)
11745 MYSQL_YYABORT;
11746 }
11747 else
11748 87779 $$.charset= $3.charset;
11749 }
11750 | nchar opt_field_length
11751 {
11752 28 $$.target= ITEM_CAST_CHAR;
11753 28 $$.charset= national_charset_info;
11754 28 $$.length= $2;
11755 28 $$.dec= NULL;
11756
1/2
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
28 warn_about_deprecated_national(YYTHD);
11757 }
11758 | SIGNED_SYM
11759 {
11760 440 $$.target= ITEM_CAST_SIGNED_INT;
11761 440 $$.charset= NULL;
11762 440 $$.length= NULL;
11763 440 $$.dec= NULL;
11764 }
11765 | SIGNED_SYM INT_SYM
11766 {
11767 29248 $$.target= ITEM_CAST_SIGNED_INT;
11768 29248 $$.charset= NULL;
11769 29248 $$.length= NULL;
11770 29248 $$.dec= NULL;
11771 }
11772 | UNSIGNED_SYM
11773 {
11774 1056212 $$.target= ITEM_CAST_UNSIGNED_INT;
11775 1056212 $$.charset= NULL;
11776 1056212 $$.length= NULL;
11777 1056212 $$.dec= NULL;
11778 }
11779 | UNSIGNED_SYM INT_SYM
11780 {
11781 213 $$.target= ITEM_CAST_UNSIGNED_INT;
11782 213 $$.charset= NULL;
11783 213 $$.length= NULL;
11784 213 $$.dec= NULL;
11785 }
11786 | DATE_SYM
11787 {
11788 1008 $$.target= ITEM_CAST_DATE;
11789 1008 $$.charset= NULL;
11790 1008 $$.length= NULL;
11791 1008 $$.dec= NULL;
11792 }
11793 | YEAR_SYM
11794 {
11795 65 $$.target= ITEM_CAST_YEAR;
11796 65 $$.charset= NULL;
11797 65 $$.length= NULL;
11798 65 $$.dec= NULL;
11799 }
11800 | TIME_SYM type_datetime_precision
11801 {
11802 754 $$.target= ITEM_CAST_TIME;
11803 754 $$.charset= NULL;
11804 754 $$.length= NULL;
11805 754 $$.dec= $2;
11806 }
11807 | DATETIME_SYM type_datetime_precision
11808 {
11809 1026 $$.target= ITEM_CAST_DATETIME;
11810 1026 $$.charset= NULL;
11811 1026 $$.length= NULL;
11812 1026 $$.dec= $2;
11813 }
11814 | DECIMAL_SYM float_options
11815 {
11816 574 $$.target=ITEM_CAST_DECIMAL;
11817 574 $$.charset= NULL;
11818 574 $$.length= $2.length;
11819 574 $$.dec= $2.dec;
11820 }
11821 | JSON_SYM
11822 {
11823 5152 $$.target=ITEM_CAST_JSON;
11824 5152 $$.charset= NULL;
11825 5152 $$.length= NULL;
11826 5152 $$.dec= NULL;
11827 }
11828 | real_type
11829 {
11830
2/2
✓ Branch 0 taken 132 times.
✓ Branch 1 taken 1 times.
133 $$.target = ($1 == Numeric_type::DOUBLE) ?
11831 ITEM_CAST_DOUBLE : ITEM_CAST_FLOAT;
11832 133 $$.charset = nullptr;
11833 133 $$.length = nullptr;
11834 133 $$.dec = nullptr;
11835 }
11836 | FLOAT_SYM standard_float_options
11837 {
11838 66 $$.target = ITEM_CAST_FLOAT;
11839 66 $$.charset = nullptr;
11840 66 $$.length = $2.length;
11841 66 $$.dec = nullptr;
11842 }
11843 | POINT_SYM
11844 {
11845 38 $$.target = ITEM_CAST_POINT;
11846 38 $$.charset = nullptr;
11847 38 $$.length = nullptr;
11848 38 $$.dec = nullptr;
11849 }
11850 | LINESTRING_SYM
11851 {
11852 36 $$.target = ITEM_CAST_LINESTRING;
11853 36 $$.charset = nullptr;
11854 36 $$.length = nullptr;
11855 36 $$.dec = nullptr;
11856 }
11857 | POLYGON_SYM
11858 {
11859 43 $$.target = ITEM_CAST_POLYGON;
11860 43 $$.charset = nullptr;
11861 43 $$.length = nullptr;
11862 43 $$.dec = nullptr;
11863 }
11864 | MULTIPOINT_SYM
11865 {
11866 30 $$.target = ITEM_CAST_MULTIPOINT;
11867 30 $$.charset = nullptr;
11868 30 $$.length = nullptr;
11869 30 $$.dec = nullptr;
11870 }
11871 | MULTILINESTRING_SYM
11872 {
11873 36 $$.target = ITEM_CAST_MULTILINESTRING;
11874 36 $$.charset = nullptr;
11875 36 $$.length = nullptr;
11876 36 $$.dec = nullptr;
11877 }
11878 | MULTIPOLYGON_SYM
11879 {
11880 35 $$.target = ITEM_CAST_MULTIPOLYGON;
11881 35 $$.charset = nullptr;
11882 35 $$.length = nullptr;
11883 35 $$.dec = nullptr;
11884 }
11885 | GEOMETRYCOLLECTION_SYM
11886 {
11887 41 $$.target = ITEM_CAST_GEOMETRYCOLLECTION;
11888 41 $$.charset = nullptr;
11889 41 $$.length = nullptr;
11890 41 $$.dec = nullptr;
11891 }
11892 ;
11893
11894 opt_expr_list:
11895 120451 /* empty */ { $$= NULL; }
11896 | expr_list
11897 ;
11898
11899 expr_list:
11900 expr
11901 {
11902
2/4
✓ Branch 0 taken 2330180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2330181 times.
✗ Branch 3 not taken.
2330180 $$= NEW_PTN PT_item_list;
11903
4/8
✓ Branch 0 taken 2330181 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2330182 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2330182 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2330182 times.
2330181 if ($$ == NULL || $$->push_back($1))
11904 MYSQL_YYABORT;
11905 }
11906 | expr_list ',' expr
11907 {
11908
4/8
✓ Branch 0 taken 2374425 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2374425 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2374425 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2374425 times.
2374425 if ($1 == NULL || $1->push_back($3))
11909 MYSQL_YYABORT;
11910 2374425 $$= $1;
11911 }
11912 ;
11913
11914 ident_list_arg:
11915 262 ident_list { $$= $1; }
11916 2496 | '(' ident_list ')' { $$= $2; }
11917 ;
11918
11919 ident_list:
11920 simple_ident
11921 {
11922
2/4
✓ Branch 0 taken 2758 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2758 times.
✗ Branch 3 not taken.
2758 $$= NEW_PTN PT_item_list;
11923
4/8
✓ Branch 0 taken 2758 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2758 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2758 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2758 times.
2758 if ($$ == NULL || $$->push_back($1))
11924 MYSQL_YYABORT;
11925 }
11926 | ident_list ',' simple_ident
11927 {
11928
4/8
✓ Branch 0 taken 1337 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1337 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1337 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1337 times.
1337 if ($1 == NULL || $1->push_back($3))
11929 MYSQL_YYABORT;
11930 1337 $$= $1;
11931 }
11932 ;
11933
11934 opt_expr:
11935 15562 /* empty */ { $$= NULL; }
11936 233647 | expr { $$= $1; }
11937 ;
11938
11939 opt_else:
11940 2030 /* empty */ { $$= NULL; }
11941 247179 | ELSE expr { $$= $2; }
11942 ;
11943
11944 when_list:
11945 WHEN_SYM expr THEN_SYM expr
11946 {
11947
1/2
✓ Branch 0 taken 249209 times.
✗ Branch 1 not taken.
249209 $$= new (YYMEM_ROOT) mem_root_deque<Item *>(YYMEM_ROOT);
11948
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 249209 times.
249209 if ($$ == NULL)
11949 MYSQL_YYABORT;
11950
1/2
✓ Branch 0 taken 249209 times.
✗ Branch 1 not taken.
249209 $$->push_back($2);
11951
1/2
✓ Branch 0 taken 249209 times.
✗ Branch 1 not taken.
249209 $$->push_back($4);
11952 }
11953 | when_list WHEN_SYM expr THEN_SYM expr
11954 {
11955
1/2
✓ Branch 0 taken 1676607 times.
✗ Branch 1 not taken.
1676607 $1->push_back($3);
11956
1/2
✓ Branch 0 taken 1676607 times.
✗ Branch 1 not taken.
1676607 $1->push_back($5);
11957 1676607 $$= $1;
11958 }
11959 ;
11960
11961 table_reference:
11962 6139523 table_factor { $$= $1; }
11963 128056 | joined_table { $$= $1; }
11964 | '{' OJ_SYM esc_table_reference '}'
11965 {
11966 /*
11967 The ODBC escape syntax for Outer Join.
11968
11969 All productions from table_factor and joined_table can be escaped,
11970 not only the '{LEFT | RIGHT} [OUTER] JOIN' syntax.
11971 */
11972 15 $$ = $3;
11973 }
11974 ;
11975
11976 esc_table_reference:
11977 2 table_factor { $$= $1; }
11978 13 | joined_table { $$= $1; }
11979 ;
11980 /*
11981 Join operations are normally left-associative, as in
11982
11983 t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t3.a = t2.a
11984
11985 This is equivalent to
11986
11987 (t1 JOIN t2 ON t1.a = t2.a) JOIN t3 ON t3.a = t2.a
11988
11989 They can also be right-associative without parentheses, e.g.
11990
11991 t1 JOIN t2 JOIN t3 ON t2.a = t3.a ON t1.a = t2.a
11992
11993 Which is equivalent to
11994
11995 t1 JOIN (t2 JOIN t3 ON t2.a = t3.a) ON t1.a = t2.a
11996
11997 In MySQL, JOIN and CROSS JOIN mean the same thing, i.e.:
11998
11999 - A join without a <join specification> is the same as a cross join.
12000 - A cross join with a <join specification> is the same as an inner join.
12001
12002 For the join operation above, this means that the parser can't know until it
12003 has seen the last ON whether `t1 JOIN t2` was a cross join or not. The only
12004 way to solve the abiguity is to keep shifting the tokens on the stack, and
12005 not reduce until the last ON is seen. We tell Bison this by adding a fake
12006 token CONDITIONLESS_JOIN which has lower precedence than all tokens that
12007 would continue the join. These are JOIN_SYM, INNER_SYM, CROSS,
12008 STRAIGHT_JOIN, NATURAL, LEFT, RIGHT, ON and USING. This way the automaton
12009 only reduces to a cross join unless no other interpretation is
12010 possible. This gives a right-deep join tree for join *with* conditions,
12011 which is what is expected.
12012
12013 The challenge here is that t1 JOIN t2 *could* have been a cross join, we
12014 just don't know it until afterwards. So if the query had been
12015
12016 t1 JOIN t2 JOIN t3 ON t2.a = t3.a
12017
12018 we will first reduce `t2 JOIN t3 ON t2.a = t3.a` to a <table_reference>,
12019 which is correct, but a problem arises when reducing t1 JOIN
12020 <table_reference>. If we were to do that, we'd get a right-deep tree. The
12021 solution is to build the tree downwards instead of upwards, as is normally
12022 done. This concept may seem outlandish at first, but it's really quite
12023 simple. When the semantic action for table_reference JOIN table_reference is
12024 executed, the parse tree is (please pardon the ASCII graphic):
12025
12026 JOIN ON t2.a = t3.a
12027 / \
12028 t2 t3
12029
12030 Now, normally we'd just add the cross join node on top of this tree, as:
12031
12032 JOIN
12033 / \
12034 t1 JOIN ON t2.a = t3.a
12035 / \
12036 t2 t3
12037
12038 This is not the meaning of the query, however. The cross join should be
12039 addded at the bottom:
12040
12041
12042 JOIN ON t2.a = t3.a
12043 / \
12044 JOIN t3
12045 / \
12046 t1 t2
12047
12048 There is only one rule to pay attention to: If the right-hand side of a
12049 cross join is a join tree, find its left-most leaf (which is a table
12050 name). Then replace this table name with a cross join of the left-hand side
12051 of the top cross join, and the right hand side with the original table.
12052
12053 Natural joins are also syntactically conditionless, but we need to make sure
12054 that they are never right associative. We handle them in their own rule
12055 natural_join, which is left-associative only. In this case we know that
12056 there is no join condition to wait for, so we can reduce immediately.
12057 */
12058 joined_table:
12059 table_reference inner_join_type table_reference ON_SYM expr
12060 {
12061
2/4
✓ Branch 0 taken 1459190 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1459190 times.
✗ Branch 3 not taken.
1459190 $$= NEW_PTN PT_joined_table_on($1, @2, $2, $3, $5);
12062 }
12063 | table_reference inner_join_type table_reference USING
12064 '(' using_list ')'
12065 {
12066
2/4
✓ Branch 0 taken 5366 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5366 times.
✗ Branch 3 not taken.
5366 $$= NEW_PTN PT_joined_table_using($1, @2, $2, $3, $6);
12067 }
12068 | table_reference outer_join_type table_reference ON_SYM expr
12069 {
12070
2/4
✓ Branch 0 taken 427479 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427479 times.
✗ Branch 3 not taken.
427479 $$= NEW_PTN PT_joined_table_on($1, @2, $2, $3, $5);
12071 }
12072 | table_reference outer_join_type table_reference USING '(' using_list ')'
12073 {
12074
2/4
✓ Branch 0 taken 6484 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6484 times.
✗ Branch 3 not taken.
6484 $$= NEW_PTN PT_joined_table_using($1, @2, $2, $3, $6);
12075 }
12076 | table_reference inner_join_type table_reference
12077 %prec CONDITIONLESS_JOIN
12078 {
12079
2/4
✓ Branch 0 taken 11408 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11408 times.
✗ Branch 3 not taken.
11408 auto this_cross_join= NEW_PTN PT_cross_join($1, @2, $2, NULL);
12080
12081
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11408 times.
11408 if ($3 == NULL)
12082 MYSQL_YYABORT; // OOM
12083
12084
1/2
✓ Branch 0 taken 11408 times.
✗ Branch 1 not taken.
11408 $$= $3->add_cross_join(this_cross_join);
12085 }
12086 | table_reference natural_join_type table_factor
12087 {
12088
2/4
✓ Branch 0 taken 2323 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2323 times.
✗ Branch 3 not taken.
2323 $$= NEW_PTN PT_joined_table_using($1, @2, $2, $3);
12089 }
12090 ;
12091
12092 natural_join_type:
12093 413 NATURAL opt_inner JOIN_SYM { $$= JTT_NATURAL_INNER; }
12094 920 | NATURAL RIGHT opt_outer JOIN_SYM { $$= JTT_NATURAL_RIGHT; }
12095 990 | NATURAL LEFT opt_outer JOIN_SYM { $$= JTT_NATURAL_LEFT; }
12096 ;
12097
12098 inner_join_type:
12099 1458581 JOIN_SYM { $$= JTT_INNER; }
12100 12542 | INNER_SYM JOIN_SYM { $$= JTT_INNER; }
12101 804 | CROSS JOIN_SYM { $$= JTT_INNER; }
12102 4056 | STRAIGHT_JOIN { $$= JTT_STRAIGHT_INNER; }
12103
12104 outer_join_type:
12105 428955 LEFT opt_outer JOIN_SYM { $$= JTT_LEFT; }
12106 5016 | RIGHT opt_outer JOIN_SYM { $$= JTT_RIGHT; }
12107 ;
12108
12109 opt_inner:
12110 /* empty */
12111 | INNER_SYM
12112 ;
12113
12114 opt_outer:
12115 /* empty */
12116 | OUTER_SYM
12117 ;
12118
12119 /*
12120 table PARTITION (list of partitions), reusing using_list instead of creating
12121 a new rule for partition_list.
12122 */
12123 opt_use_partition:
12124 9292662 /* empty */ { $$= NULL; }
12125 | use_partition
12126 ;
12127
12128 use_partition:
12129 PARTITION_SYM '(' using_list ')'
12130 {
12131 1639 $$= $3;
12132 }
12133 ;
12134
12135 /**
12136 MySQL has a syntax extension where a comma-separated list of table
12137 references is allowed as a table reference in itself, for instance
12138
12139 SELECT * FROM (t1, t2) JOIN t3 ON 1
12140
12141 which is not allowed in standard SQL. The syntax is equivalent to
12142
12143 SELECT * FROM (t1 CROSS JOIN t2) JOIN t3 ON 1
12144
12145 We call this rule table_reference_list_parens.
12146
12147 A <table_factor> may be a <single_table>, a <subquery>, a <derived_table>, a
12148 <joined_table>, or the bespoke <table_reference_list_parens>, each of those
12149 enclosed in any number of parentheses. This makes for an ambiguous grammar
12150 since a <table_factor> may also be enclosed in parentheses. We get around
12151 this by designing the grammar so that a <table_factor> does not have
12152 parentheses, but all the sub-cases of it have their own parentheses-rules,
12153 i.e. <single_table_parens>, <joined_table_parens> and
12154 <table_reference_list_parens>. It's a bit tedious but the grammar is
12155 unambiguous and doesn't have shift/reduce conflicts.
12156 */
12157 table_factor:
12158 single_table
12159 | single_table_parens
12160 12235 | derived_table { $$ = $1; }
12161 | joined_table_parens
12162
2/4
✓ Branch 0 taken 1784181 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1784181 times.
✗ Branch 3 not taken.
1784181 { $$= NEW_PTN PT_table_factor_joined_table($1); }
12163 | table_reference_list_parens
12164
2/4
✓ Branch 0 taken 583 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 583 times.
✗ Branch 3 not taken.
583 { $$= NEW_PTN PT_table_reference_list_parens($1); }
12165 7967 | table_function { $$ = $1; }
12166 ;
12167
12168 table_reference_list_parens:
12169 9 '(' table_reference_list_parens ')' { $$= $2; }
12170 | '(' table_reference_list ',' table_reference ')'
12171 {
12172 583 $$= $2;
12173
2/4
✓ Branch 0 taken 583 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 583 times.
583 if ($$.push_back($4))
12174 MYSQL_YYABORT; // OOM
12175 }
12176 ;
12177
12178 single_table_parens:
12179 29 '(' single_table_parens ')' { $$= $2; }
12180 95 | '(' single_table ')' { $$= $2; }
12181 ;
12182
12183 single_table:
12184 table_ident opt_use_partition opt_table_alias opt_key_definition
12185 {
12186
2/4
✓ Branch 0 taken 4336884 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4336890 times.
✗ Branch 3 not taken.
4336891 $$= NEW_PTN PT_table_factor_table_ident($1, $2, $3, $4);
12187 }
12188 ;
12189
12190 joined_table_parens:
12191 34 '(' joined_table_parens ')' { $$= $2; }
12192 1784181 | '(' joined_table ')' { $$= $2; }
12193 ;
12194
12195 derived_table:
12196 table_subquery opt_table_alias opt_derived_column_list
12197 {
12198 /*
12199 The alias is actually not optional at all, but being MySQL we
12200 are friendly and give an informative error message instead of
12201 just 'syntax error'.
12202 */
12203
2/2
✓ Branch 0 taken 59 times.
✓ Branch 1 taken 10889 times.
10948 if ($2.str == nullptr)
12204
2/4
✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 59 times.
✗ Branch 3 not taken.
59 my_message(ER_DERIVED_MUST_HAVE_ALIAS,
12205 ER_THD(YYTHD, ER_DERIVED_MUST_HAVE_ALIAS), MYF(0));
12206
12207
2/4
✓ Branch 0 taken 10948 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10948 times.
✗ Branch 3 not taken.
10948 $$= NEW_PTN PT_derived_table(false, $1, $2, &$3);
12208 }
12209 | LATERAL_SYM table_subquery opt_table_alias opt_derived_column_list
12210 {
12211
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1287 times.
1287 if ($3.str == nullptr)
12212 my_message(ER_DERIVED_MUST_HAVE_ALIAS,
12213 ER_THD(YYTHD, ER_DERIVED_MUST_HAVE_ALIAS), MYF(0));
12214
12215
2/4
✓ Branch 0 taken 1287 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1287 times.
✗ Branch 3 not taken.
1287 $$= NEW_PTN PT_derived_table(true, $2, $3, &$4);
12216 }
12217 ;
12218
12219 table_function:
12220 JSON_TABLE_SYM '(' expr ',' text_literal columns_clause ')'
12221 opt_table_alias
12222 {
12223 // Alias isn't optional, follow derived's behavior
12224
2/4
✓ Branch 0 taken 7808 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7808 times.
7808 if ($8 == NULL_CSTR)
12225 {
12226 my_message(ER_TF_MUST_HAVE_ALIAS,
12227 ER_THD(YYTHD, ER_TF_MUST_HAVE_ALIAS), MYF(0));
12228 MYSQL_YYABORT;
12229 }
12230
12231
2/4
✓ Branch 0 taken 7808 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7808 times.
✗ Branch 3 not taken.
7808 $$= NEW_PTN PT_table_factor_function($3, $5, $6, to_lex_string($8));
12232 }
12233 | SEQUENCE_TABLE_SYM '(' expr ')' opt_table_alias
12234 {
12235 // Alias isn't optional, follow derived's behavior
12236
3/4
✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 159 times.
160 if ($5 == NULL_CSTR)
12237 {
12238
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 my_message(ER_TF_MUST_HAVE_ALIAS,
12239 ER_THD(YYTHD, ER_TF_MUST_HAVE_ALIAS), MYF(0));
12240 1 MYSQL_YYABORT;
12241 }
12242
2/4
✓ Branch 0 taken 159 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 159 times.
✗ Branch 3 not taken.
159 $$= NEW_PTN PT_table_sequence_function($3, $5);
12243 }
12244 ;
12245
12246 columns_clause:
12247 COLUMNS '(' columns_list ')'
12248 {
12249 7813 $$= $3;
12250 }
12251 ;
12252
12253 columns_list:
12254 jt_column
12255 {
12256
2/4
✓ Branch 0 taken 7813 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7813 times.
✗ Branch 3 not taken.
7813 $$= NEW_PTN Mem_root_array<PT_json_table_column *>(YYMEM_ROOT);
12257
4/8
✓ Branch 0 taken 7813 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7813 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7813 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 7813 times.
7813 if ($$ == NULL || $$->push_back($1))
12258 MYSQL_YYABORT; // OOM
12259 }
12260 | columns_list ',' jt_column
12261 {
12262 8626 $$= $1;
12263
2/4
✓ Branch 0 taken 8626 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8626 times.
8626 if ($$->push_back($3))
12264 MYSQL_YYABORT; // OOM
12265 }
12266 ;
12267
12268 jt_column:
12269 ident FOR_SYM ORDINALITY_SYM
12270 {
12271
2/4
✓ Branch 0 taken 87 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 87 times.
✗ Branch 3 not taken.
87 $$= NEW_PTN PT_json_table_column_for_ordinality($1);
12272 }
12273 | ident type opt_collate jt_column_type PATH_SYM text_literal
12274 opt_on_empty_or_error_json_table
12275 {
12276 auto column = make_unique_destroy_only<Json_table_column>(
12277 16347 YYMEM_ROOT, $4, $6, $7.error.type, $7.error.default_string,
12278
1/2
✓ Branch 0 taken 16347 times.
✗ Branch 1 not taken.
16347 $7.empty.type, $7.empty.default_string);
12279
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16347 times.
16347 if (column == nullptr) MYSQL_YYABORT; // OOM
12280
1/2
✓ Branch 0 taken 16347 times.
✗ Branch 1 not taken.
49041 $$ = NEW_PTN PT_json_table_column_with_path(std::move(column), $1,
12281
1/2
✓ Branch 0 taken 16347 times.
✗ Branch 1 not taken.
32694 $2, $3);
12282
1/2
✓ Branch 0 taken 16347 times.
✗ Branch 1 not taken.
16347 }
12283 | NESTED_SYM PATH_SYM text_literal columns_clause
12284 {
12285
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 $$= NEW_PTN PT_json_table_column_with_nested_path($3, $4);
12286 }
12287 ;
12288
12289 jt_column_type:
12290 {
12291 16340 $$= enum_jt_column::JTC_PATH;
12292 }
12293 | EXISTS
12294 {
12295 7 $$= enum_jt_column::JTC_EXISTS;
12296 }
12297 ;
12298
12299 // The optional ON EMPTY and ON ERROR clauses for JSON_TABLE and
12300 // JSON_VALUE. If both clauses are specified, the ON EMPTY clause
12301 // should come before the ON ERROR clause.
12302 opt_on_empty_or_error:
12303 /* empty */
12304 {
12305 16322 $$.empty = {Json_on_response_type::IMPLICIT, nullptr};
12306 16322 $$.error = {Json_on_response_type::IMPLICIT, nullptr};
12307 }
12308 | on_empty
12309 {
12310 34 $$.empty = $1;
12311 34 $$.error = {Json_on_response_type::IMPLICIT, nullptr};
12312 }
12313 | on_error
12314 {
12315 $$.error = $1;
12316 $$.empty = {Json_on_response_type::IMPLICIT, nullptr};
12317 }
12318 | on_empty on_error
12319 {
12320 1 $$.empty = $1;
12321 1 $$.error = $2;
12322 }
12323 ;
12324
12325 // JSON_TABLE extends the syntax by allowing ON ERROR to come before ON EMPTY.
12326 opt_on_empty_or_error_json_table:
12327 16347 opt_on_empty_or_error { $$ = $1; }
12328 | on_error on_empty
12329 {
12330 push_warning(
12331 YYTHD, Sql_condition::SL_WARNING, ER_WARN_DEPRECATED_SYNTAX,
12332 ER_THD(YYTHD, ER_WARN_DEPRECATED_JSON_TABLE_ON_ERROR_ON_EMPTY));
12333 $$.error = $1;
12334 $$.empty = $2;
12335 }
12336 ;
12337
12338 on_empty:
12339 35 json_on_response ON_SYM EMPTY_SYM { $$= $1; }
12340 ;
12341 on_error:
12342 1 json_on_response ON_SYM ERROR_SYM { $$= $1; }
12343 ;
12344 json_on_response:
12345 ERROR_SYM
12346 {
12347 $$ = {Json_on_response_type::ERROR, nullptr};
12348 }
12349 | NULL_SYM
12350 {
12351 $$ = {Json_on_response_type::NULL_VALUE, nullptr};
12352 }
12353 | DEFAULT_SYM signed_literal
12354 {
12355 36 $$ = {Json_on_response_type::DEFAULT, $2};
12356 }
12357 ;
12358
12359 index_hint_clause:
12360 /* empty */
12361 {
12362
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4034 times.
4034 $$= old_mode ? INDEX_HINT_MASK_JOIN : INDEX_HINT_MASK_ALL;
12363 }
12364 18 | FOR_SYM JOIN_SYM { $$= INDEX_HINT_MASK_JOIN; }
12365 29 | FOR_SYM ORDER_SYM BY { $$= INDEX_HINT_MASK_ORDER; }
12366 21 | FOR_SYM GROUP_SYM BY { $$= INDEX_HINT_MASK_GROUP; }
12367 ;
12368
12369 index_hint_type:
12370 2057 FORCE_SYM { $$= INDEX_HINT_FORCE; }
12371 636 | IGNORE_SYM { $$= INDEX_HINT_IGNORE; }
12372 ;
12373
12374 index_hint_definition:
12375 index_hint_type key_or_index index_hint_clause
12376 '(' key_usage_list ')'
12377 {
12378
1/2
✓ Branch 0 taken 2691 times.
✗ Branch 1 not taken.
2691 init_index_hints($5, $1, $3);
12379 2691 $$= $5;
12380 }
12381 | USE_SYM key_or_index index_hint_clause
12382 '(' opt_key_usage_list ')'
12383 {
12384
1/2
✓ Branch 0 taken 1409 times.
✗ Branch 1 not taken.
1409 init_index_hints($5, INDEX_HINT_USE, $3);
12385 1409 $$= $5;
12386 }
12387 ;
12388
12389 index_hints_list:
12390 index_hint_definition
12391 | index_hints_list index_hint_definition
12392 {
12393
1/2
✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
19 $2->concat($1);
12394 19 $$= $2;
12395 }
12396 ;
12397
12398 opt_index_hints_list:
12399 4332808 /* empty */ { $$= NULL; }
12400 | index_hints_list
12401 ;
12402
12403 opt_key_definition:
12404 opt_index_hints_list
12405 ;
12406
12407 opt_key_usage_list:
12408 /* empty */
12409 {
12410
1/2
✓ Branch 0 taken 1257 times.
✗ Branch 1 not taken.
1257 $$= NEW_PTN List<Index_hint>;
12411
1/2
✓ Branch 0 taken 1257 times.
✗ Branch 1 not taken.
1257 Index_hint *hint= NEW_PTN Index_hint(NULL, 0);
12412
5/10
✓ Branch 0 taken 1257 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1257 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1257 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1257 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1257 times.
1257 if ($$ == NULL || hint == NULL || $$->push_front(hint))
12413 MYSQL_YYABORT;
12414 }
12415 | key_usage_list
12416 ;
12417
12418 key_usage_element:
12419 ident
12420 {
12421
1/2
✓ Branch 0 taken 2922 times.
✗ Branch 1 not taken.
2922 $$= NEW_PTN Index_hint($1.str, $1.length);
12422
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2922 times.
2922 if ($$ == NULL)
12423 MYSQL_YYABORT;
12424 }
12425 | PRIMARY_SYM
12426 {
12427
1/2
✓ Branch 0 taken 123 times.
✗ Branch 1 not taken.
123 $$= NEW_PTN Index_hint(STRING_WITH_LEN("PRIMARY"));
12428
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 123 times.
123 if ($$ == NULL)
12429 MYSQL_YYABORT;
12430 }
12431 ;
12432
12433 key_usage_list:
12434 key_usage_element
12435 {
12436
1/2
✓ Branch 0 taken 2854 times.
✗ Branch 1 not taken.
2854 $$= NEW_PTN List<Index_hint>;
12437
4/8
✓ Branch 0 taken 2854 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2854 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2854 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2854 times.
2854 if ($$ == NULL || $$->push_front($1))
12438 MYSQL_YYABORT;
12439 }
12440 | key_usage_list ',' key_usage_element
12441 {
12442
2/4
✓ Branch 0 taken 191 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 191 times.
191 if ($$->push_front($3))
12443 MYSQL_YYABORT;
12444 }
12445 ;
12446
12447 using_list:
12448 ident_string_list
12449 ;
12450
12451 ident_string_list:
12452 ident
12453 {
12454
1/2
✓ Branch 0 taken 15043 times.
✗ Branch 1 not taken.
15043 $$= NEW_PTN List<String>;
12455 15043 String *s= NEW_PTN String(const_cast<const char *>($1.str),
12456 $1.length,
12457
1/2
✓ Branch 0 taken 15043 times.
✗ Branch 1 not taken.
15043 system_charset_info);
12458
5/10
✓ Branch 0 taken 15043 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15043 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 15043 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 15043 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 15043 times.
15043 if ($$ == NULL || s == NULL || $$->push_back(s))
12459 MYSQL_YYABORT;
12460 }
12461 | ident_string_list ',' ident
12462 {
12463 2358 String *s= NEW_PTN String(const_cast<const char *>($3.str),
12464 $3.length,
12465
1/2
✓ Branch 0 taken 2358 times.
✗ Branch 1 not taken.
2358 system_charset_info);
12466
4/8
✓ Branch 0 taken 2358 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2358 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2358 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2358 times.
2358 if (s == NULL || $1->push_back(s))
12467 MYSQL_YYABORT;
12468 2358 $$= $1;
12469 }
12470 ;
12471
12472 interval:
12473 interval_time_stamp {}
12474 20 | DAY_HOUR_SYM { $$=INTERVAL_DAY_HOUR; }
12475 17 | DAY_MICROSECOND_SYM { $$=INTERVAL_DAY_MICROSECOND; }
12476 20 | DAY_MINUTE_SYM { $$=INTERVAL_DAY_MINUTE; }
12477 25 | DAY_SECOND_SYM { $$=INTERVAL_DAY_SECOND; }
12478 17 | HOUR_MICROSECOND_SYM { $$=INTERVAL_HOUR_MICROSECOND; }
12479 20 | HOUR_MINUTE_SYM { $$=INTERVAL_HOUR_MINUTE; }
12480 22 | HOUR_SECOND_SYM { $$=INTERVAL_HOUR_SECOND; }
12481 17 | MINUTE_MICROSECOND_SYM { $$=INTERVAL_MINUTE_MICROSECOND; }
12482 36 | MINUTE_SECOND_SYM { $$=INTERVAL_MINUTE_SECOND; }
12483 16 | SECOND_MICROSECOND_SYM { $$=INTERVAL_SECOND_MICROSECOND; }
12484 26 | YEAR_MONTH_SYM { $$=INTERVAL_YEAR_MONTH; }
12485 ;
12486
12487 interval_time_stamp:
12488 459 DAY_SYM { $$=INTERVAL_DAY; }
12489 68 | WEEK_SYM { $$=INTERVAL_WEEK; }
12490 271 | HOUR_SYM { $$=INTERVAL_HOUR; }
12491 176 | MINUTE_SYM { $$=INTERVAL_MINUTE; }
12492 250 | MONTH_SYM { $$=INTERVAL_MONTH; }
12493 28 | QUARTER_SYM { $$=INTERVAL_QUARTER; }
12494 11335 | SECOND_SYM { $$=INTERVAL_SECOND; }
12495 85 | MICROSECOND_SYM { $$=INTERVAL_MICROSECOND; }
12496 153 | YEAR_SYM { $$=INTERVAL_YEAR; }
12497 ;
12498
12499 date_time_type:
12500 21 DATE_SYM {$$= MYSQL_TIMESTAMP_DATE; }
12501 2 | TIME_SYM {$$= MYSQL_TIMESTAMP_TIME; }
12502 1 | TIMESTAMP_SYM {$$= MYSQL_TIMESTAMP_DATETIME; }
12503 5 | DATETIME_SYM {$$= MYSQL_TIMESTAMP_DATETIME; }
12504 ;
12505
12506 opt_as:
12507 /* empty */
12508 | AS
12509 ;
12510
12511 opt_table_alias:
12512 1980157 /* empty */ { $$ = NULL_CSTR; }
12513 2498595 | opt_as ident { $$ = to_lex_cstring($2); }
12514 ;
12515
12516 opt_all:
12517 /* empty */
12518 | ALL
12519 ;
12520
12521 opt_where_clause:
12522 7918146 /* empty */ { $$ = nullptr; }
12523 | where_clause
12524 ;
12525
12526 where_clause:
12527
2/4
✓ Branch 0 taken 1751650 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1751679 times.
✗ Branch 3 not taken.
1751675 WHERE expr { $$ = NEW_PTN PTI_where(@2, $2); }
12528 ;
12529
12530 opt_having_clause:
12531 9377506 /* empty */ { $$= NULL; }
12532 | HAVING expr
12533 {
12534
2/4
✓ Branch 0 taken 8638 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8638 times.
✗ Branch 3 not taken.
8638 $$= new PTI_having(@$, $2);
12535 }
12536 ;
12537
12538 with_clause:
12539 WITH with_list
12540 {
12541
2/4
✓ Branch 0 taken 651 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 651 times.
✗ Branch 3 not taken.
651 $$= NEW_PTN PT_with_clause($2, false);
12542 }
12543 | WITH RECURSIVE_SYM with_list
12544 {
12545
2/4
✓ Branch 0 taken 6599 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6599 times.
✗ Branch 3 not taken.
6599 $$= NEW_PTN PT_with_clause($3, true);
12546 }
12547 ;
12548
12549 with_list:
12550 with_list ',' common_table_expr
12551 {
12552
3/4
✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 178 times.
180 if ($1->push_back($3))
12553 2 MYSQL_YYABORT;
12554 }
12555 | common_table_expr
12556 {
12557
2/4
✓ Branch 0 taken 7254 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7254 times.
✗ Branch 3 not taken.
7254 $$= NEW_PTN PT_with_list(YYTHD->mem_root);
12558
4/8
✓ Branch 0 taken 7254 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7254 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7254 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 7254 times.
7254 if ($$ == NULL || $$->push_back($1))
12559 MYSQL_YYABORT; /* purecov: inspected */
12560 }
12561 ;
12562
12563 common_table_expr:
12564 ident opt_derived_column_list AS table_subquery
12565 {
12566 LEX_STRING subq_text;
12567 7434 subq_text.length= @4.cpp.length();
12568
1/2
✓ Branch 0 taken 7434 times.
✗ Branch 1 not taken.
7434 subq_text.str= YYTHD->strmake(@4.cpp.start, subq_text.length);
12569
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7434 times.
7434 if (subq_text.str == NULL)
12570 MYSQL_YYABORT; /* purecov: inspected */
12571 7434 uint subq_text_offset= @4.cpp.start - YYLIP->get_cpp_buf();
12572 14868 $$= NEW_PTN PT_common_table_expr($1, subq_text, subq_text_offset,
12573
2/4
✓ Branch 0 taken 7434 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7434 times.
✗ Branch 3 not taken.
7434 $4, &$2, YYTHD->mem_root);
12574
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7434 times.
7434 if ($$ == NULL)
12575 MYSQL_YYABORT; /* purecov: inspected */
12576 }
12577 ;
12578
12579 opt_derived_column_list:
12580 /* empty */
12581 {
12582 /*
12583 Because () isn't accepted by the rule of
12584 simple_ident_list, we can use an empty array to
12585 designates that the parenthesised list was omitted.
12586 */
12587 42899 $$.init(YYTHD->mem_root);
12588 }
12589 | '(' simple_ident_list ')'
12590 {
12591 44672 $$= $2;
12592 }
12593 ;
12594
12595 simple_ident_list:
12596 ident
12597 {
12598 44672 $$.init(YYTHD->mem_root);
12599
2/4
✓ Branch 0 taken 44672 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 44672 times.
44672 if ($$.push_back(to_lex_cstring($1)))
12600 MYSQL_YYABORT; /* purecov: inspected */
12601 }
12602 | simple_ident_list ',' ident
12603 {
12604 375364 $$= $1;
12605
2/4
✓ Branch 0 taken 375364 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 375364 times.
375364 if ($$.push_back(to_lex_cstring($3)))
12606 MYSQL_YYABORT; /* purecov: inspected */
12607 }
12608 ;
12609
12610 opt_window_clause:
12611 /* Nothing */
12612 {
12613 9385252 $$= NULL;
12614 }
12615 | WINDOW_SYM window_definition_list
12616 {
12617 891 $$= $2;
12618 }
12619 ;
12620
12621 window_definition_list:
12622 window_definition
12623 {
12624
1/2
✓ Branch 0 taken 891 times.
✗ Branch 1 not taken.
1782 $$= NEW_PTN PT_window_list();
12625
4/8
✓ Branch 0 taken 891 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 891 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 891 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 891 times.
891 if ($$ == NULL || $$->push_back($1))
12626 MYSQL_YYABORT; // OOM
12627 }
12628 | window_definition_list ',' window_definition
12629 {
12630
2/4
✓ Branch 0 taken 105 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 105 times.
105 if ($1->push_back($3))
12631 MYSQL_YYABORT; // OOM
12632 105 $$= $1;
12633 }
12634 ;
12635
12636 window_definition:
12637 window_name AS window_spec
12638 {
12639 996 $$= $3;
12640
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 996 times.
996 if ($$ == NULL)
12641 MYSQL_YYABORT; // OOM
12642 996 $$->set_name($1);
12643 }
12644 ;
12645
12646 /*
12647 group by statement in select
12648 */
12649
12650 opt_group_clause:
12651 9266961 /* empty */ { $$= NULL; }
12652 | GROUP_SYM BY group_list olap_opt
12653 {
12654
2/4
✓ Branch 0 taken 119179 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 119179 times.
✗ Branch 3 not taken.
119179 $$= NEW_PTN PT_group($3, $4);
12655 }
12656 ;
12657
12658 group_list:
12659 group_list ',' grouping_expr
12660 {
12661
1/2
✓ Branch 0 taken 55570 times.
✗ Branch 1 not taken.
55570 $1->push_back($3);
12662 55570 $$= $1;
12663 }
12664 | grouping_expr
12665 {
12666
1/2
✓ Branch 0 taken 119809 times.
✗ Branch 1 not taken.
239618 $$= NEW_PTN PT_order_list();
12667
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 119809 times.
119809 if ($$ == NULL)
12668 MYSQL_YYABORT;
12669
1/2
✓ Branch 0 taken 119809 times.
✗ Branch 1 not taken.
119809 $$->push_back($1);
12670 }
12671 ;
12672
12673
12674 olap_opt:
12675 118738 /* empty */ { $$= UNSPECIFIED_OLAP_TYPE; }
12676 441 | WITH_ROLLUP_SYM { $$= ROLLUP_TYPE; }
12677 /*
12678 'WITH ROLLUP' is needed for backward compatibility,
12679 and cause LALR(2) conflicts.
12680 This syntax is not standard.
12681 MySQL syntax: GROUP BY col1, col2, col3 WITH ROLLUP
12682 SQL-2003: GROUP BY ... ROLLUP(col1, col2, col3)
12683 */
12684 ;
12685
12686 /*
12687 Order by statement in ALTER TABLE
12688 */
12689
12690 alter_order_list:
12691 alter_order_list ',' alter_order_item
12692 {
12693 72 $$= $1;
12694
1/2
✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
72 $$->push_back($3);
12695 }
12696 | alter_order_item
12697 {
12698
1/2
✓ Branch 0 taken 87 times.
✗ Branch 1 not taken.
174 $$= NEW_PTN PT_order_list();
12699
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 87 times.
87 if ($$ == NULL)
12700 MYSQL_YYABORT;
12701
1/2
✓ Branch 0 taken 87 times.
✗ Branch 1 not taken.
87 $$->push_back($1);
12702 }
12703 ;
12704
12705 alter_order_item:
12706 simple_ident_nospvar opt_ordering_direction
12707 {
12708
2/4
✓ Branch 0 taken 159 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 159 times.
✗ Branch 3 not taken.
159 $$= NEW_PTN PT_order_expr($1, $2);
12709 }
12710 ;
12711
12712 opt_order_clause:
12713 8944528 /* empty */ { $$= NULL; }
12714 | order_clause
12715 ;
12716
12717 order_clause:
12718 ORDER_SYM BY order_list
12719 {
12720
2/4
✓ Branch 0 taken 670465 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 670465 times.
✗ Branch 3 not taken.
670465 $$= NEW_PTN PT_order($3);
12721 }
12722 ;
12723
12724 order_list:
12725 order_list ',' order_expr
12726 {
12727
1/2
✓ Branch 0 taken 327670 times.
✗ Branch 1 not taken.
327670 $1->push_back($3);
12728 327670 $$= $1;
12729 }
12730 | order_expr
12731 {
12732
1/2
✓ Branch 0 taken 672520 times.
✗ Branch 1 not taken.
1345040 $$= NEW_PTN PT_order_list();
12733
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 672520 times.
672520 if ($$ == NULL)
12734 MYSQL_YYABORT;
12735
1/2
✓ Branch 0 taken 672520 times.
✗ Branch 1 not taken.
672520 $$->push_back($1);
12736 }
12737 ;
12738
12739 opt_ordering_direction:
12740 3170544 /* empty */ { $$= ORDER_NOT_RELEVANT; }
12741 | ordering_direction
12742 ;
12743
12744 ordering_direction:
12745 5107 ASC { $$= ORDER_ASC; }
12746 137983 | DESC { $$= ORDER_DESC; }
12747 ;
12748
12749 opt_limit_clause:
12750 9401906 /* empty */ { $$= NULL; }
12751 | limit_clause
12752 ;
12753
12754 limit_clause:
12755 LIMIT limit_options
12756 {
12757
2/4
✓ Branch 0 taken 54964 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 54965 times.
✗ Branch 3 not taken.
54965 $$= NEW_PTN PT_limit_clause($2);
12758 }
12759 ;
12760
12761 limit_options:
12762 limit_option
12763 {
12764 52395 $$.limit= $1;
12765 52395 $$.opt_offset= NULL;
12766 52395 $$.is_offset_first= false;
12767 }
12768 | limit_option ',' limit_option
12769 {
12770 2366 $$.limit= $3;
12771 2366 $$.opt_offset= $1;
12772 2366 $$.is_offset_first= true;
12773 }
12774 | limit_option OFFSET_SYM limit_option
12775 {
12776 204 $$.limit= $1;
12777 204 $$.opt_offset= $3;
12778 204 $$.is_offset_first= false;
12779 }
12780 ;
12781
12782 limit_option:
12783 ident
12784 {
12785
2/4
✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 63 times.
✗ Branch 3 not taken.
63 $$= NEW_PTN PTI_limit_option_ident(@$, to_lex_cstring($1));
12786 }
12787 | param_marker
12788 {
12789
2/4
✓ Branch 0 taken 75 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 75 times.
✗ Branch 3 not taken.
75 $$= NEW_PTN PTI_limit_option_param_marker(@$, $1);
12790 }
12791 | ULONGLONG_NUM
12792 {
12793
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 $$= NEW_PTN Item_uint(@$, $1.str, $1.length);
12794 }
12795 | LONG_NUM
12796 {
12797
2/4
✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
20 $$= NEW_PTN Item_uint(@$, $1.str, $1.length);
12798 }
12799 | NUM
12800 {
12801
2/4
✓ Branch 0 taken 58691 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 58689 times.
✗ Branch 3 not taken.
58691 $$= NEW_PTN Item_uint(@$, $1.str, $1.length);
12802 }
12803 ;
12804
12805 opt_simple_limit:
12806 277289 /* empty */ { $$= NULL; }
12807 1308 | LIMIT limit_option { $$= $2; }
12808 ;
12809
12810 ulong_num:
12811
1/2
✓ Branch 0 taken 371093 times.
✗ Branch 1 not taken.
371093 NUM { int error; $$= (ulong) my_strtoll10($1.str, nullptr, &error); }
12812 2094 | HEX_NUM { $$= (ulong) my_strtoll($1.str, (char**) 0, 16); }
12813
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 | LONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, nullptr, &error); }
12814
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 | ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, nullptr, &error); }
12815
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 | DECIMAL_NUM { int error; $$= (ulong) my_strtoll10($1.str, nullptr, &error); }
12816 | FLOAT_NUM { int error; $$= (ulong) my_strtoll10($1.str, nullptr, &error); }
12817 ;
12818
12819 real_ulong_num:
12820
1/2
✓ Branch 0 taken 26033 times.
✗ Branch 1 not taken.
26033 NUM { int error; $$= (ulong) my_strtoll10($1.str, nullptr, &error); }
12821 | HEX_NUM { $$= (ulong) my_strtoll($1.str, (char**) 0, 16); }
12822
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 | LONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, nullptr, &error); }
12823 | ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, nullptr, &error); }
12824 31 | dec_num_error { MYSQL_YYABORT; }
12825 ;
12826
12827 ulonglong_num:
12828
1/2
✓ Branch 0 taken 15445 times.
✗ Branch 1 not taken.
15445 NUM { int error; $$= (ulonglong) my_strtoll10($1.str, nullptr, &error); }
12829
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 | ULONGLONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, nullptr, &error); }
12830
1/2
✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
11 | LONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, nullptr, &error); }
12831 | DECIMAL_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, nullptr, &error); }
12832 | FLOAT_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, nullptr, &error); }
12833 ;
12834
12835 real_ulonglong_num:
12836
1/2
✓ Branch 0 taken 2147 times.
✗ Branch 1 not taken.
2147 NUM { int error; $$= (ulonglong) my_strtoll10($1.str, nullptr, &error); }
12837 4 | HEX_NUM { $$= (ulonglong) my_strtoll($1.str, (char**) 0, 16); }
12838 | ULONGLONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, nullptr, &error); }
12839
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 | LONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, nullptr, &error); }
12840 3 | dec_num_error { MYSQL_YYABORT; }
12841 ;
12842
12843 dec_num_error:
12844 dec_num
12845
1/2
✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
34 { YYTHD->syntax_error(ER_ONLY_INTEGERS_ALLOWED); }
12846 ;
12847
12848 dec_num:
12849 DECIMAL_NUM
12850 | FLOAT_NUM
12851 ;
12852
12853 select_var_list:
12854 select_var_list ',' select_var_ident
12855 {
12856 4014 $$= $1;
12857
4/8
✓ Branch 0 taken 4014 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4014 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4014 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4014 times.
4014 if ($$ == NULL || $$->push_back($3))
12858 MYSQL_YYABORT;
12859 }
12860 | select_var_ident
12861 {
12862
2/4
✓ Branch 0 taken 167023 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 167023 times.
✗ Branch 3 not taken.
167023 $$= NEW_PTN PT_select_var_list(@$);
12863
4/8
✓ Branch 0 taken 167023 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 167022 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 167022 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 167022 times.
167023 if ($$ == NULL || $$->push_back($1))
12864 MYSQL_YYABORT;
12865 }
12866 ;
12867
12868 select_var_ident:
12869 '@' ident_or_text
12870 {
12871
2/4
✓ Branch 0 taken 97523 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 97523 times.
✗ Branch 3 not taken.
97523 $$= NEW_PTN PT_select_var($2);
12872 }
12873 | ident_or_text
12874 {
12875
2/4
✓ Branch 0 taken 73514 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73514 times.
✗ Branch 3 not taken.
73514 $$= NEW_PTN PT_select_sp_var($1);
12876 }
12877 ;
12878
12879 into_clause:
12880 INTO into_destination
12881 {
12882 182471 $$= $2;
12883 }
12884 ;
12885
12886 into_destination:
12887 OUTFILE TEXT_STRING_filesystem
12888 opt_load_data_charset
12889 opt_field_term opt_line_term
12890 {
12891
2/4
✓ Branch 0 taken 15007 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15007 times.
✗ Branch 3 not taken.
15007 $$= NEW_PTN PT_into_destination_outfile(@$, $2, $3, $4, $5);
12892 }
12893 | DUMPFILE TEXT_STRING_filesystem
12894 {
12895
2/4
✓ Branch 0 taken 441 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 441 times.
✗ Branch 3 not taken.
441 $$= NEW_PTN PT_into_destination_dumpfile(@$, $2);
12896 }
12897 167023 | select_var_list { $$= $1; }
12898 ;
12899
12900 /*
12901 DO statement
12902 */
12903
12904 do_stmt:
12905 DO_SYM select_item_list
12906 {
12907
1/2
✓ Branch 0 taken 15032 times.
✗ Branch 1 not taken.
30064 $$= NEW_PTN PT_select_stmt(SQLCOM_DO,
12908
1/2
✓ Branch 0 taken 15032 times.
✗ Branch 1 not taken.
30064 NEW_PTN PT_query_expression(
12909
3/6
✓ Branch 0 taken 15032 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15032 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 15032 times.
✗ Branch 5 not taken.
75160 NEW_PTN PT_query_specification({}, $2)));
12910 }
12911 ;
12912
12913 /*
12914 Drop : delete tables or index or user or role
12915 */
12916
12917 drop_table_stmt:
12918 DROP opt_temporary table_or_tables if_exists table_list opt_restrict
12919 {
12920 // Note: opt_restrict ($6) is ignored!
12921 166967 LEX *lex=Lex;
12922 166967 lex->sql_command = SQLCOM_DROP_TABLE;
12923 166967 lex->drop_temporary= $2;
12924 166967 lex->drop_if_exists= $4;
12925 166967 YYPS->m_lock_type= TL_UNLOCK;
12926 166967 YYPS->m_mdl_type= MDL_EXCLUSIVE;
12927
2/2
✓ Branch 0 taken 48 times.
✓ Branch 1 taken 166920 times.
333935 if (Select->add_tables(YYTHD, $5, TL_OPTION_UPDATING,
12928
1/2
✓ Branch 0 taken 166968 times.
✗ Branch 1 not taken.
166967 YYPS->m_lock_type, YYPS->m_mdl_type))
12929 48 MYSQL_YYABORT;
12930 }
12931 ;
12932
12933 drop_index_stmt:
12934 DROP INDEX_SYM ident ON_SYM table_ident opt_index_lock_and_algorithm
12935 {
12936
1/2
✓ Branch 0 taken 4051 times.
✗ Branch 1 not taken.
8102 $$= NEW_PTN PT_drop_index_stmt(YYMEM_ROOT, $3.str, $5,
12937
1/2
✓ Branch 0 taken 4051 times.
✗ Branch 1 not taken.
4051 $6.algo.get_or_default(),
12938
2/4
✓ Branch 0 taken 4051 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4051 times.
✗ Branch 3 not taken.
8102 $6.lock.get_or_default());
12939 }
12940 ;
12941
12942 drop_database_stmt:
12943 DROP DATABASE if_exists ident
12944 {
12945 6233 LEX *lex=Lex;
12946 6233 lex->sql_command= SQLCOM_DROP_DB;
12947 6233 lex->drop_if_exists=$3;
12948 6233 lex->name= $4;
12949 }
12950 ;
12951
12952 drop_function_stmt:
12953 DROP FUNCTION_SYM if_exists ident '.' ident
12954 {
12955 1463 THD *thd= YYTHD;
12956 1463 LEX *lex= thd->lex;
12957 sp_name *spname;
12958
3/4
✓ Branch 0 taken 1463 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1462 times.
2926 if ($4.str &&
12959
3/4
✓ Branch 0 taken 1463 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1462 times.
1463 (check_and_convert_db_name(&$4, false) != Ident_name_check::OK))
12960 1 MYSQL_YYABORT;
12961
3/4
✓ Branch 0 taken 1462 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1461 times.
1462 if (sp_check_name(&$6))
12962 1 MYSQL_YYABORT;
12963
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1461 times.
1461 if (lex->sphead)
12964 {
12965 my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
12966 MYSQL_YYABORT;
12967 }
12968 1461 lex->sql_command = SQLCOM_DROP_FUNCTION;
12969 1461 lex->drop_if_exists= $3;
12970
1/2
✓ Branch 0 taken 1461 times.
✗ Branch 1 not taken.
1461 spname= new (YYMEM_ROOT) sp_name(to_lex_cstring($4), $6, true);
12971
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1461 times.
1461 if (spname == NULL)
12972 MYSQL_YYABORT;
12973
1/2
✓ Branch 0 taken 1461 times.
✗ Branch 1 not taken.
1461 spname->init_qname(thd);
12974 1461 lex->spname= spname;
12975 }
12976 | DROP FUNCTION_SYM if_exists ident
12977 {
12978 /*
12979 Unlike DROP PROCEDURE, "DROP FUNCTION ident" should work
12980 even if there is no current database. In this case it
12981 applies only to UDF.
12982 Hence we can't merge rules for "DROP FUNCTION ident.ident"
12983 and "DROP FUNCTION ident" into one "DROP FUNCTION sp_name"
12984 rule. sp_name assumes that database name should be always
12985 provided - either explicitly or implicitly.
12986 */
12987 16919 THD *thd= YYTHD;
12988 16919 LEX *lex= thd->lex;
12989 16919 LEX_STRING db= NULL_STR;
12990 sp_name *spname;
12991
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 16916 times.
16919 if (lex->sphead)
12992 {
12993
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
12994 5 MYSQL_YYABORT;
12995 }
12996
5/8
✓ Branch 0 taken 16913 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 16913 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 16913 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 16916 times.
16916 if (thd->db().str && lex->copy_db_to(&db.str, &db.length))
12997 MYSQL_YYABORT;
12998
3/4
✓ Branch 0 taken 16916 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 16914 times.
16916 if (sp_check_name(&$4))
12999 2 MYSQL_YYABORT;
13000 16914 lex->sql_command = SQLCOM_DROP_FUNCTION;
13001 16914 lex->drop_if_exists= $3;
13002
1/2
✓ Branch 0 taken 16914 times.
✗ Branch 1 not taken.
16914 spname= new (YYMEM_ROOT) sp_name(to_lex_cstring(db), $4, false);
13003
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16914 times.
16914 if (spname == NULL)
13004 MYSQL_YYABORT;
13005
1/2
✓ Branch 0 taken 16914 times.
✗ Branch 1 not taken.
16914 spname->init_qname(thd);
13006 16914 lex->spname= spname;
13007 }
13008 ;
13009
13010 drop_resource_group_stmt:
13011 DROP RESOURCE_SYM GROUP_SYM ident opt_force
13012 {
13013
1/2
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
21 $$= NEW_PTN PT_drop_resource_group(to_lex_cstring($4), $5);
13014 }
13015 ;
13016
13017 drop_procedure_stmt:
13018 DROP PROCEDURE_SYM if_exists sp_name
13019 {
13020 19508 LEX *lex=Lex;
13021
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 19506 times.
19508 if (lex->sphead)
13022 {
13023
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE");
13024 2 MYSQL_YYABORT;
13025 }
13026 19506 lex->sql_command = SQLCOM_DROP_PROCEDURE;
13027 19506 lex->drop_if_exists= $3;
13028 19506 lex->spname= $4;
13029 }
13030 ;
13031
13032 drop_user_stmt:
13033 DROP USER if_exists user_list
13034 {
13035 5631 LEX *lex=Lex;
13036 5631 lex->sql_command= SQLCOM_DROP_USER;
13037 5631 lex->drop_if_exists= $3;
13038 5631 lex->users_list= *$4;
13039 }
13040 ;
13041
13042 drop_view_stmt:
13043 DROP VIEW_SYM if_exists table_list opt_restrict
13044 {
13045 // Note: opt_restrict ($5) is ignored!
13046 4833 LEX *lex= Lex;
13047 4833 lex->sql_command= SQLCOM_DROP_VIEW;
13048 4833 lex->drop_if_exists= $3;
13049 4833 YYPS->m_lock_type= TL_UNLOCK;
13050 4833 YYPS->m_mdl_type= MDL_EXCLUSIVE;
13051
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 4832 times.
9666 if (Select->add_tables(YYTHD, $4, TL_OPTION_UPDATING,
13052
1/2
✓ Branch 0 taken 4833 times.
✗ Branch 1 not taken.
4833 YYPS->m_lock_type, YYPS->m_mdl_type))
13053 1 MYSQL_YYABORT;
13054 }
13055 ;
13056
13057 drop_event_stmt:
13058 DROP EVENT_SYM if_exists sp_name
13059 {
13060 505 Lex->drop_if_exists= $3;
13061 505 Lex->spname= $4;
13062 505 Lex->sql_command = SQLCOM_DROP_EVENT;
13063 }
13064 ;
13065
13066 drop_trigger_stmt:
13067 DROP TRIGGER_SYM if_exists sp_name
13068 {
13069 11342 LEX *lex= Lex;
13070 11342 lex->sql_command= SQLCOM_DROP_TRIGGER;
13071 11342 lex->drop_if_exists= $3;
13072 11342 lex->spname= $4;
13073
1/2
✓ Branch 0 taken 11342 times.
✗ Branch 1 not taken.
22684 Lex->m_sql_cmd= new (YYTHD->mem_root) Sql_cmd_drop_trigger();
13074 }
13075 ;
13076
13077 drop_tablespace_stmt:
13078 DROP TABLESPACE_SYM ident opt_drop_ts_options
13079 {
13080
2/4
✓ Branch 0 taken 934 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 934 times.
✗ Branch 3 not taken.
934 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
13081
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 934 times.
934 if (pc == NULL)
13082 MYSQL_YYABORT; /* purecov: inspected */ // OOM
13083
13084
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 928 times.
934 if ($4 != NULL)
13085 {
13086
5/10
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 6 times.
6 if (YYTHD->is_error() || contextualize_array(pc, $4))
13087 MYSQL_YYABORT; /* purecov: inspected */
13088 }
13089
13090
2/4
✓ Branch 0 taken 934 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 934 times.
✗ Branch 3 not taken.
934 auto cmd= NEW_PTN Sql_cmd_drop_tablespace{$3, pc};
13091
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 934 times.
934 if (!cmd)
13092 MYSQL_YYABORT; /* purecov: inspected */ // OOM
13093 934 Lex->m_sql_cmd= cmd;
13094 934 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
13095 }
13096
13097 drop_undo_tablespace_stmt:
13098 DROP UNDO_SYM TABLESPACE_SYM ident opt_undo_tablespace_options
13099 {
13100
2/4
✓ Branch 0 taken 343 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 343 times.
✗ Branch 3 not taken.
343 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
13101
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 343 times.
343 if (pc == NULL)
13102 MYSQL_YYABORT; // OOM
13103
13104
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 341 times.
343 if ($5 != NULL)
13105 {
13106
5/10
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
2 if (YYTHD->is_error() || contextualize_array(pc, $5))
13107 MYSQL_YYABORT;
13108 }
13109
13110 auto cmd= NEW_PTN Sql_cmd_drop_undo_tablespace{
13111
2/4
✓ Branch 0 taken 343 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 343 times.
✗ Branch 3 not taken.
343 DROP_UNDO_TABLESPACE, $4, {nullptr, 0}, pc};
13112
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 343 times.
343 if (!cmd)
13113 MYSQL_YYABORT; // OOM
13114 343 Lex->m_sql_cmd= cmd;
13115 343 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
13116 }
13117 ;
13118
13119 drop_logfile_stmt:
13120 DROP LOGFILE_SYM GROUP_SYM ident opt_drop_ts_options
13121 {
13122
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
13123
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (pc == NULL)
13124 MYSQL_YYABORT; /* purecov: inspected */ // OOM
13125
13126
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3 times.
5 if ($5 != NULL)
13127 {
13128
5/10
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
2 if (YYTHD->is_error() || contextualize_array(pc, $5))
13129 MYSQL_YYABORT; /* purecov: inspected */
13130 }
13131
13132 auto cmd= NEW_PTN Sql_cmd_logfile_group{DROP_LOGFILE_GROUP,
13133
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 $4, pc};
13134
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (!cmd)
13135 MYSQL_YYABORT; /* purecov: inspected */ // OOM
13136 5 Lex->m_sql_cmd= cmd;
13137 5 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
13138 }
13139
13140 ;
13141
13142 drop_server_stmt:
13143 DROP SERVER_SYM if_exists ident_or_text
13144 {
13145 57 Lex->sql_command = SQLCOM_DROP_SERVER;
13146
1/2
✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
57 Lex->m_sql_cmd= NEW_PTN Sql_cmd_drop_server($4, $3);
13147 }
13148 | DROP COMPRESSION_DICTIONARY_SYM if_exists ident
13149 {
13150 92 Lex->sql_command= SQLCOM_DROP_COMPRESSION_DICTIONARY;
13151 92 Lex->drop_if_exists= $3;
13152 92 Lex->ident= $4;
13153 }
13154 ;
13155
13156 drop_srs_stmt:
13157 DROP SPATIAL_SYM REFERENCE_SYM SYSTEM_SYM if_exists real_ulonglong_num
13158 {
13159
1/2
✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
206 $$= NEW_PTN PT_drop_srs($6, $5);
13160 }
13161 ;
13162
13163 drop_role_stmt:
13164 DROP ROLE_SYM if_exists role_list
13165 {
13166
1/2
✓ Branch 0 taken 533 times.
✗ Branch 1 not taken.
533 $$= NEW_PTN PT_drop_role($3, $4);
13167 }
13168 ;
13169
13170 table_list:
13171 table_ident
13172 {
13173
2/4
✓ Branch 0 taken 212309 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 212309 times.
✗ Branch 3 not taken.
212309 $$= NEW_PTN Mem_root_array<Table_ident *>(YYMEM_ROOT);
13174
2/4
✓ Branch 0 taken 212311 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 212311 times.
212309 if ($$->push_back($1))
13175 MYSQL_YYABORT; // OOM
13176 }
13177 | table_list ',' table_ident
13178 {
13179 677382 $$= $1;
13180
4/8
✓ Branch 0 taken 677382 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 677383 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 677383 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 677383 times.
677382 if ($$ == NULL || $$->push_back($3))
13181 MYSQL_YYABORT; // OOM
13182 }
13183 ;
13184
13185 table_alias_ref_list:
13186 table_ident_opt_wild
13187 {
13188 1217 $$.init(YYMEM_ROOT);
13189
2/4
✓ Branch 0 taken 1217 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1217 times.
1217 if ($$.push_back($1))
13190 MYSQL_YYABORT; // OOM
13191 }
13192 | table_alias_ref_list ',' table_ident_opt_wild
13193 {
13194 767 $$= $1;
13195
2/4
✓ Branch 0 taken 767 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 767 times.
767 if ($$.push_back($3))
13196 MYSQL_YYABORT; // OOM
13197 }
13198 ;
13199
13200 if_exists:
13201 183023 /* empty */ { $$= 0; }
13202 61868 | IF EXISTS { $$= 1; }
13203 ;
13204
13205 opt_ignore_unknown_user:
13206 4055 /* empty */ { $$= 0; }
13207 21 | IGNORE_SYM UNKNOWN_SYM USER { $$= 1; }
13208 ;
13209
13210 opt_temporary:
13211 712082 /* empty */ { $$= false; }
13212 76650 | TEMPORARY { $$= true; }
13213 ;
13214
13215 opt_drop_ts_options:
13216 931 /* empty*/ { $$= NULL; }
13217 | drop_ts_option_list
13218 ;
13219
13220 drop_ts_option_list:
13221 drop_ts_option
13222 {
13223
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 $$= NEW_PTN Mem_root_array<PT_alter_tablespace_option_base*>(YYMEM_ROOT);
13224
4/8
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 8 times.
8 if ($$ == NULL || $$->push_back($1))
13225 MYSQL_YYABORT; /* purecov: inspected */ // OOM
13226 }
13227 | drop_ts_option_list opt_comma drop_ts_option
13228 {
13229 $$= $1;
13230 if ($$->push_back($3))
13231 MYSQL_YYABORT; /* purecov: inspected */ // OOM
13232 }
13233 ;
13234
13235 drop_ts_option:
13236 ts_option_engine
13237 | ts_option_wait
13238 ;
13239 /*
13240 ** Insert : add new data to table
13241 */
13242
13243 insert_stmt:
13244 INSERT_SYM /* #1 */
13245 insert_lock_option /* #2 */
13246 opt_ignore /* #3 */
13247 opt_INTO /* #4 */
13248 table_ident /* #5 */
13249 opt_use_partition /* #6 */
13250 insert_from_constructor /* #7 */
13251 opt_values_reference /* #8 */
13252 opt_insert_update_list /* #9 */
13253 {
13254
2/6
✓ Branch 0 taken 2782183 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2782183 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
2782363 DBUG_EXECUTE_IF("bug29614521_simulate_oom",
13255 DBUG_SET("+d,simulate_out_of_memory"););
13256
1/2
✓ Branch 0 taken 2782628 times.
✗ Branch 1 not taken.
5565108 $$= NEW_PTN PT_insert(false, $1, $2, $3, $5, $6,
13257 2782628 $7.column_list, $7.row_value_list,
13258 NULL,
13259 2782628 $8.table_alias, $8.column_list,
13260
1/2
✓ Branch 0 taken 2782480 times.
✗ Branch 1 not taken.
5564811 $9.column_list, $9.value_list);
13261
2/6
✓ Branch 0 taken 2782877 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2782877 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
2782480 DBUG_EXECUTE_IF("bug29614521_simulate_oom",
13262 DBUG_SET("-d,bug29614521_simulate_oom"););
13263 }
13264 | INSERT_SYM /* #1 */
13265 insert_lock_option /* #2 */
13266 opt_ignore /* #3 */
13267 opt_INTO /* #4 */
13268 table_ident /* #5 */
13269 opt_use_partition /* #6 */
13270 SET_SYM /* #7 */
13271 update_list /* #8 */
13272 opt_values_reference /* #9 */
13273 opt_insert_update_list /* #10 */
13274 {
13275
2/4
✓ Branch 0 taken 15368 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15368 times.
✗ Branch 3 not taken.
15368 PT_insert_values_list *one_row= NEW_PTN PT_insert_values_list(YYMEM_ROOT);
13276
4/8
✓ Branch 0 taken 15368 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15368 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 15368 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 15368 times.
15368 if (one_row == NULL || one_row->push_back(&$8.value_list->value))
13277 MYSQL_YYABORT; // OOM
13278
1/2
✓ Branch 0 taken 15368 times.
✗ Branch 1 not taken.
30736 $$= NEW_PTN PT_insert(false, $1, $2, $3, $5, $6,
13279 15368 $8.column_list, one_row,
13280 NULL,
13281 15368 $9.table_alias, $9.column_list,
13282
1/2
✓ Branch 0 taken 15368 times.
✗ Branch 1 not taken.
30736 $10.column_list, $10.value_list);
13283 }
13284 | INSERT_SYM /* #1 */
13285 insert_lock_option /* #2 */
13286 opt_ignore /* #3 */
13287 opt_INTO /* #4 */
13288 table_ident /* #5 */
13289 opt_use_partition /* #6 */
13290 insert_query_expression /* #7 */
13291 opt_insert_update_list /* #8 */
13292 {
13293
1/2
✓ Branch 0 taken 44600 times.
✗ Branch 1 not taken.
89200 $$= NEW_PTN PT_insert(false, $1, $2, $3, $5, $6,
13294 44600 $7.column_list, NULL,
13295 44600 $7.insert_query_expression,
13296 NULL_CSTR, NULL,
13297
1/2
✓ Branch 0 taken 44600 times.
✗ Branch 1 not taken.
89200 $8.column_list, $8.value_list);
13298 }
13299 ;
13300
13301 replace_stmt:
13302 REPLACE_SYM /* #1 */
13303 replace_lock_option /* #2 */
13304 opt_INTO /* #3 */
13305 table_ident /* #4 */
13306 opt_use_partition /* #5 */
13307 insert_from_constructor /* #6 */
13308 {
13309
1/2
✓ Branch 0 taken 1958274 times.
✗ Branch 1 not taken.
3916548 $$= NEW_PTN PT_insert(true, $1, $2, false, $4, $5,
13310 $6.column_list, $6.row_value_list,
13311 NULL,
13312 NULL_CSTR, NULL,
13313
1/2
✓ Branch 0 taken 1958274 times.
✗ Branch 1 not taken.
3916548 NULL, NULL);
13314 }
13315 | REPLACE_SYM /* #1 */
13316 replace_lock_option /* #2 */
13317 opt_INTO /* #3 */
13318 table_ident /* #4 */
13319 opt_use_partition /* #5 */
13320 SET_SYM /* #6 */
13321 update_list /* #7 */
13322 {
13323
2/4
✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 206 times.
✗ Branch 3 not taken.
206 PT_insert_values_list *one_row= NEW_PTN PT_insert_values_list(YYMEM_ROOT);
13324
4/8
✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 206 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 206 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 206 times.
206 if (one_row == NULL || one_row->push_back(&$7.value_list->value))
13325 MYSQL_YYABORT; // OOM
13326
1/2
✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
412 $$= NEW_PTN PT_insert(true, $1, $2, false, $4, $5,
13327 $7.column_list, one_row,
13328 NULL,
13329 NULL_CSTR, NULL,
13330
1/2
✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
412 NULL, NULL);
13331 }
13332 | REPLACE_SYM /* #1 */
13333 replace_lock_option /* #2 */
13334 opt_INTO /* #3 */
13335 table_ident /* #4 */
13336 opt_use_partition /* #5 */
13337 insert_query_expression /* #6 */
13338 {
13339
1/2
✓ Branch 0 taken 735 times.
✗ Branch 1 not taken.
1470 $$= NEW_PTN PT_insert(true, $1, $2, false, $4, $5,
13340 $6.column_list, NULL,
13341 $6.insert_query_expression,
13342 NULL_CSTR, NULL,
13343
1/2
✓ Branch 0 taken 735 times.
✗ Branch 1 not taken.
1470 NULL, NULL);
13344 }
13345 ;
13346
13347 insert_lock_option:
13348 2842552 /* empty */ { $$= TL_WRITE_CONCURRENT_DEFAULT; }
13349 14 | LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; }
13350 | DELAYED_SYM
13351 {
13352 22 $$= TL_WRITE_CONCURRENT_DEFAULT;
13353
13354
2/4
✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
✗ Branch 3 not taken.
22 push_warning_printf(YYTHD, Sql_condition::SL_WARNING,
13355 ER_WARN_LEGACY_SYNTAX_CONVERTED,
13356 ER_THD(YYTHD, ER_WARN_LEGACY_SYNTAX_CONVERTED),
13357 "INSERT DELAYED", "INSERT");
13358 }
13359 3 | HIGH_PRIORITY { $$= TL_WRITE; }
13360 ;
13361
13362 replace_lock_option:
13363 1959219 opt_low_priority { $$= $1; }
13364 | DELAYED_SYM
13365 {
13366 3 $$= TL_WRITE_DEFAULT;
13367
13368
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 push_warning_printf(YYTHD, Sql_condition::SL_WARNING,
13369 ER_WARN_LEGACY_SYNTAX_CONVERTED,
13370 ER_THD(YYTHD, ER_WARN_LEGACY_SYNTAX_CONVERTED),
13371 "REPLACE DELAYED", "REPLACE");
13372 }
13373 ;
13374
13375 opt_INTO:
13376 /* empty */
13377 | INTO
13378 ;
13379
13380 insert_from_constructor:
13381 insert_values
13382 {
13383
2/4
✓ Branch 0 taken 1026574 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1026852 times.
✗ Branch 3 not taken.
1026563 $$.column_list= NEW_PTN PT_item_list;
13384 1026852 $$.row_value_list= $1;
13385 }
13386 | '(' ')' insert_values
13387 {
13388
2/4
✓ Branch 0 taken 783 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 783 times.
✗ Branch 3 not taken.
783 $$.column_list= NEW_PTN PT_item_list;
13389 783 $$.row_value_list= $3;
13390 }
13391 | '(' fields ')' insert_values
13392 {
13393 3713276 $$.column_list= $2;
13394 3713276 $$.row_value_list= $4;
13395 }
13396 ;
13397
13398 insert_query_expression:
13399 query_expression_or_parens
13400 {
13401
2/4
✓ Branch 0 taken 26498 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 26498 times.
✗ Branch 3 not taken.
26498 $$.column_list= NEW_PTN PT_item_list;
13402 26498 $$.insert_query_expression= $1;
13403 }
13404 | '(' ')' query_expression_or_parens
13405 {
13406
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 $$.column_list= NEW_PTN PT_item_list;
13407 1 $$.insert_query_expression= $3;
13408 }
13409 | '(' fields ')' query_expression_or_parens
13410 {
13411 18836 $$.column_list= $2;
13412 18836 $$.insert_query_expression= $4;
13413 }
13414 ;
13415
13416 fields:
13417 fields ',' insert_ident
13418 {
13419
2/4
✓ Branch 0 taken 14589838 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14589838 times.
14589834 if ($$->push_back($3))
13420 MYSQL_YYABORT;
13421 14589838 $$= $1;
13422 }
13423 | insert_ident
13424 {
13425
2/4
✓ Branch 0 taken 3732113 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3732124 times.
✗ Branch 3 not taken.
3732104 $$= NEW_PTN PT_item_list;
13426
4/8
✓ Branch 0 taken 3732130 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3732134 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3732134 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 3732128 times.
3732124 if ($$ == NULL || $$->push_back($1))
13427 MYSQL_YYABORT;
13428 }
13429 ;
13430
13431 insert_values:
13432 value_or_values values_list
13433 {
13434 4740575 $$= $2;
13435 }
13436 ;
13437
13438 query_expression_or_parens:
13439 121885 query_expression { $$ = $1; }
13440 | query_expression locking_clause_list
13441 {
13442
2/4
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
✗ Branch 3 not taken.
17 $$ = NEW_PTN PT_locking($1, $2);
13443 }
13444 2141 | query_expression_parens { $$ = $1; }
13445 ;
13446
13447 value_or_values:
13448 VALUE_SYM
13449 | VALUES
13450 ;
13451
13452 values_list:
13453 values_list ',' row_value
13454 {
13455
2/4
✓ Branch 0 taken 637553 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 637553 times.
637553 if ($$->push_back(&$3->value))
13456 MYSQL_YYABORT;
13457 }
13458 | row_value
13459 {
13460
2/4
✓ Branch 0 taken 4740498 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4740534 times.
✗ Branch 3 not taken.
4740696 $$= NEW_PTN PT_insert_values_list(YYMEM_ROOT);
13461
4/8
✓ Branch 0 taken 4740603 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4741066 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4741097 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4740997 times.
4740534 if ($$ == NULL || $$->push_back(&$1->value))
13462 MYSQL_YYABORT;
13463 }
13464 ;
13465
13466
13467 values_row_list:
13468 values_row_list ',' row_value_explicit
13469 {
13470
2/4
✓ Branch 0 taken 123 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 123 times.
123 if ($$->push_back(&$3->value))
13471 MYSQL_YYABORT;
13472 }
13473 | row_value_explicit
13474 {
13475
2/4
✓ Branch 0 taken 171 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 171 times.
✗ Branch 3 not taken.
171 $$= NEW_PTN PT_insert_values_list(YYMEM_ROOT);
13476
4/8
✓ Branch 0 taken 171 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 171 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 171 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 171 times.
171 if ($$ == nullptr || $$->push_back(&$1->value))
13477 MYSQL_YYABORT;
13478 }
13479 ;
13480
13481 equal:
13482 EQ
13483 | SET_VAR
13484 ;
13485
13486 opt_equal:
13487 /* empty */
13488 | equal
13489 ;
13490
13491 row_value:
13492 5377970 '(' opt_values ')' { $$= $2; }
13493 ;
13494
13495 row_value_explicit:
13496 294 ROW_SYM '(' opt_values ')' { $$= $3; }
13497 ;
13498
13499 opt_values:
13500 /* empty */
13501 {
13502
2/4
✓ Branch 0 taken 1099 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1099 times.
✗ Branch 3 not taken.
1099 $$= NEW_PTN PT_item_list;
13503
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1099 times.
1099 if ($$ == NULL)
13504 MYSQL_YYABORT;
13505 }
13506 | values
13507 ;
13508
13509 values:
13510 values ',' expr_or_default
13511 {
13512
2/4
✓ Branch 0 taken 19731125 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19731125 times.
19731139 if ($1->push_back($3))
13513 MYSQL_YYABORT;
13514 19731125 $$= $1;
13515 }
13516 | expr_or_default
13517 {
13518
2/4
✓ Branch 0 taken 5377415 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5377799 times.
✗ Branch 3 not taken.
5377511 $$= NEW_PTN PT_item_list;
13519
4/8
✓ Branch 0 taken 5377871 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5377844 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5377896 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5377772 times.
5377799 if ($$ == NULL || $$->push_back($1))
13520 MYSQL_YYABORT;
13521 }
13522 ;
13523
13524 expr_or_default:
13525 expr
13526 | DEFAULT_SYM
13527 {
13528
2/4
✓ Branch 0 taken 4514 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4514 times.
✗ Branch 3 not taken.
4514 $$= NEW_PTN Item_default_value(@$);
13529 }
13530 ;
13531
13532 opt_values_reference:
13533 /* empty */
13534 {
13535 2798327 $$.table_alias = NULL_CSTR;
13536 2798327 $$.column_list = NULL;
13537 }
13538 | AS ident opt_derived_column_list
13539 {
13540 82 $$.table_alias = to_lex_cstring($2);
13541 /* The column list object is short-lived, requiring duplication. */
13542
1/2
✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
82 void *column_list_raw_mem= YYTHD->memdup(&($3), sizeof($3));
13543
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
82 if (!column_list_raw_mem)
13544 MYSQL_YYABORT; // OOM
13545 82 $$.column_list =
13546 static_cast<Create_col_name_list *>(column_list_raw_mem);
13547 }
13548 ;
13549
13550 opt_insert_update_list:
13551 /* empty */
13552 {
13553 2840932 $$.value_list= NULL;
13554 2840932 $$.column_list= NULL;
13555 }
13556 | ON_SYM DUPLICATE_SYM KEY_SYM UPDATE_SYM update_list
13557 {
13558 2037 $$= $5;
13559 }
13560 ;
13561
13562 /* Update rows in a table */
13563
13564 update_stmt:
13565 opt_with_clause
13566 UPDATE_SYM /* #1 */
13567 opt_low_priority /* #2 */
13568 opt_ignore /* #3 */
13569 table_reference_list /* #4 */
13570 SET_SYM /* #5 */
13571 update_list /* #6 */
13572 opt_where_clause /* #7 */
13573 opt_order_clause /* #8 */
13574 opt_simple_limit /* #9 */
13575 {
13576
1/2
✓ Branch 0 taken 163593 times.
✗ Branch 1 not taken.
327191 $$= NEW_PTN PT_update($1, $2, $3, $4, $5, $7.column_list, $7.value_list,
13577 327188 $8, $9, $10);
13578 }
13579 ;
13580
13581 opt_with_clause:
13582 280006 /* empty */ { $$= NULL; }
13583 74 | with_clause { $$= $1; }
13584 ;
13585
13586 update_list:
13587 update_list ',' update_elem
13588 {
13589 88751 $$= $1;
13590
3/6
✓ Branch 0 taken 88751 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 88751 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 88751 times.
177502 if ($$.column_list->push_back($3.column) ||
13591
2/4
✓ Branch 0 taken 88751 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 88751 times.
88751 $$.value_list->push_back($3.value))
13592 MYSQL_YYABORT; // OOM
13593 }
13594 | update_elem
13595 {
13596
2/4
✓ Branch 0 taken 181213 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 181221 times.
✗ Branch 3 not taken.
181238 $$.column_list= NEW_PTN PT_item_list;
13597
2/4
✓ Branch 0 taken 181223 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 181221 times.
✗ Branch 3 not taken.
181221 $$.value_list= NEW_PTN PT_item_list;
13598
1/2
✓ Branch 0 taken 181223 times.
✗ Branch 1 not taken.
181222 if ($$.column_list == NULL || $$.value_list == NULL ||
13599
4/8
✓ Branch 0 taken 181222 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 181219 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 181219 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 181218 times.
543663 $$.column_list->push_back($1.column) ||
13600
2/4
✓ Branch 0 taken 181220 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 181220 times.
181219 $$.value_list->push_back($1.value))
13601 MYSQL_YYABORT; // OOM
13602 }
13603 ;
13604
13605 update_elem:
13606 simple_ident_nospvar equal expr_or_default
13607 {
13608 269970 $$.column= $1;
13609 269970 $$.value= $3;
13610 }
13611 ;
13612
13613 opt_low_priority:
13614 2122815 /* empty */ { $$= TL_WRITE_DEFAULT; }
13615 22 | LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; }
13616 ;
13617
13618 /* Delete rows from a table */
13619
13620 delete_stmt:
13621 opt_with_clause
13622 DELETE_SYM
13623 opt_delete_options
13624 FROM
13625 table_ident
13626 opt_table_alias
13627 opt_use_partition
13628 opt_where_clause
13629 opt_order_clause
13630 opt_simple_limit
13631 {
13632
2/4
✓ Branch 0 taken 114998 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 115005 times.
✗ Branch 3 not taken.
114998 $$= NEW_PTN PT_delete($1, $2, $3, $5, $6, $7, $8, $9, $10);
13633 }
13634 | opt_with_clause
13635 DELETE_SYM
13636 opt_delete_options
13637 table_alias_ref_list
13638 FROM
13639 table_reference_list
13640 opt_where_clause
13641 {
13642
2/4
✓ Branch 0 taken 738 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 738 times.
✗ Branch 3 not taken.
738 $$= NEW_PTN PT_delete($1, $2, $3, $4, $6, $7);
13643 }
13644 | opt_with_clause
13645 DELETE_SYM
13646 opt_delete_options
13647 FROM
13648 table_alias_ref_list
13649 USING
13650 table_reference_list
13651 opt_where_clause
13652 {
13653
2/4
✓ Branch 0 taken 225 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 225 times.
✗ Branch 3 not taken.
225 $$= NEW_PTN PT_delete($1, $2, $3, $5, $7, $8);
13654 }
13655 ;
13656
13657 opt_wild:
13658 /* empty */
13659 | '.' '*'
13660 ;
13661
13662 opt_delete_options:
13663 115971 /* empty */ { $$= 0; }
13664 286 | opt_delete_option opt_delete_options { $$= $1 | $2; }
13665 ;
13666
13667 opt_delete_option:
13668 115 QUICK { $$= DELETE_QUICK; }
13669 20 | LOW_PRIORITY { $$= DELETE_LOW_PRIORITY; }
13670 151 | IGNORE_SYM { $$= DELETE_IGNORE; }
13671 ;
13672
13673 truncate_stmt:
13674 TRUNCATE_SYM opt_table table_ident
13675 {
13676
2/4
✓ Branch 0 taken 97788 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 97788 times.
✗ Branch 3 not taken.
97788 $$= NEW_PTN PT_truncate_table_stmt($3);
13677 }
13678 ;
13679
13680 opt_table:
13681 /* empty */
13682 | TABLE_SYM
13683 ;
13684
13685 opt_profile_defs:
13686 7 /* empty */ { $$ = 0; }
13687 | profile_defs
13688 ;
13689
13690 profile_defs:
13691 profile_def
13692 1 | profile_defs ',' profile_def { $$ = $1 | $3; }
13693 ;
13694
13695 profile_def:
13696 6 CPU_SYM { $$ = PROFILE_CPU; }
13697 2 | MEMORY_SYM { $$ = PROFILE_MEMORY; }
13698 2 | BLOCK_SYM IO_SYM { $$ = PROFILE_BLOCK_IO; }
13699 1 | CONTEXT_SYM SWITCHES_SYM { $$ = PROFILE_CONTEXT; }
13700 1 | PAGE_SYM FAULTS_SYM { $$ = PROFILE_PAGE_FAULTS; }
13701 2 | IPC_SYM { $$ = PROFILE_IPC; }
13702 1 | SWAPS_SYM { $$ = PROFILE_SWAPS; }
13703 1 | SOURCE_SYM { $$ = PROFILE_SOURCE; }
13704 4 | ALL { $$ = PROFILE_ALL; }
13705 ;
13706
13707 opt_for_query:
13708 16 /* empty */ { $$ = 0; }
13709 | FOR_SYM QUERY_SYM NUM
13710 {
13711 int error;
13712
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 $$ = static_cast<my_thread_id>(my_strtoll10($3.str, NULL, &error));
13713
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
10 if (error != 0)
13714 MYSQL_YYABORT;
13715 }
13716 ;
13717
13718 /* SHOW statements */
13719
13720 show_databases_stmt:
13721 SHOW DATABASES opt_wild_or_where
13722 {
13723
1/2
✓ Branch 0 taken 403 times.
✗ Branch 1 not taken.
403 $$ = NEW_PTN PT_show_databases(@$, $3.wild, $3.where);
13724 }
13725
13726 show_tables_stmt:
13727 SHOW opt_show_cmd_type TABLES opt_db opt_wild_or_where
13728 {
13729
1/2
✓ Branch 0 taken 26603 times.
✗ Branch 1 not taken.
26603 $$ = NEW_PTN PT_show_tables(@$, $2, $4, $5.wild, $5.where);
13730 }
13731 ;
13732
13733 show_triggers_stmt:
13734 SHOW opt_full TRIGGERS_SYM opt_db opt_wild_or_where
13735 {
13736
1/2
✓ Branch 0 taken 4668 times.
✗ Branch 1 not taken.
4668 $$ = NEW_PTN PT_show_triggers(@$, $2, $4, $5.wild, $5.where);
13737 }
13738 ;
13739
13740 show_events_stmt:
13741 SHOW EVENTS_SYM opt_db opt_wild_or_where
13742 {
13743
1/2
✓ Branch 0 taken 438 times.
✗ Branch 1 not taken.
438 $$ = NEW_PTN PT_show_events(@$, $3, $4.wild, $4.where);
13744 }
13745 ;
13746
13747 show_table_status_stmt:
13748 SHOW TABLE_SYM STATUS_SYM opt_db opt_wild_or_where
13749 {
13750
1/2
✓ Branch 0 taken 3920 times.
✗ Branch 1 not taken.
3920 $$ = NEW_PTN PT_show_table_status(@$, $4, $5.wild, $5.where);
13751 }
13752 ;
13753
13754 show_open_tables_stmt:
13755 SHOW OPEN_SYM TABLES opt_db opt_wild_or_where
13756 {
13757
1/2
✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
74 $$ = NEW_PTN PT_show_open_tables(@$, $4, $5.wild, $5.where);
13758 }
13759 ;
13760
13761 show_plugins_stmt:
13762 SHOW PLUGINS_SYM
13763 {
13764
1/2
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
9 $$ = NEW_PTN PT_show_plugins(@$);
13765 }
13766 ;
13767
13768 show_engine_logs_stmt:
13769 SHOW ENGINE_SYM engine_or_all LOGS_SYM
13770 {
13771
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 $$ = NEW_PTN PT_show_engine_logs(@$, $3);
13772 }
13773 ;
13774
13775 show_engine_mutex_stmt:
13776 SHOW ENGINE_SYM engine_or_all MUTEX_SYM
13777 {
13778
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 $$ = NEW_PTN PT_show_engine_mutex(@$, $3);
13779 }
13780 ;
13781
13782 show_engine_status_stmt:
13783 SHOW ENGINE_SYM engine_or_all STATUS_SYM
13784 {
13785
1/2
✓ Branch 0 taken 335 times.
✗ Branch 1 not taken.
335 $$ = NEW_PTN PT_show_engine_status(@$, $3);
13786 }
13787 ;
13788
13789 show_columns_stmt:
13790 SHOW /* 1 */
13791 opt_show_cmd_type /* 2 */
13792 COLUMNS /* 3 */
13793 from_or_in /* 4 */
13794 table_ident /* 5 */
13795 opt_db /* 6 */
13796 opt_wild_or_where /* 7 */
13797 {
13798 // TODO: error if table_ident is <db>.<table> and opt_db is set.
13799
2/2
✓ Branch 0 taken 2552 times.
✓ Branch 1 taken 6005 times.
8557 if ($6)
13800 2552 $5->change_db($6);
13801
13802
1/2
✓ Branch 0 taken 8557 times.
✗ Branch 1 not taken.
8557 $$ = NEW_PTN PT_show_fields(@$, $2, $5, $7.wild, $7.where);
13803 }
13804 ;
13805
13806 show_binary_logs_stmt:
13807 SHOW master_or_binary LOGS_SYM
13808 {
13809
1/2
✓ Branch 0 taken 262 times.
✗ Branch 1 not taken.
262 $$ = NEW_PTN PT_show_binlogs(@$);
13810 }
13811 ;
13812
13813 show_replicas_stmt:
13814 SHOW SLAVE HOSTS_SYM
13815 {
13816 133 Lex->set_replication_deprecated_syntax_used();
13817
1/2
✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
133 push_deprecated_warn(YYTHD, "SHOW SLAVE HOSTS", "SHOW REPLICAS");
13818
13819
1/2
✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
133 $$ = NEW_PTN PT_show_replicas(@$);
13820 }
13821 | SHOW REPLICAS_SYM
13822 {
13823
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 $$ = NEW_PTN PT_show_replicas(@$);
13824 }
13825 ;
13826
13827 show_binlog_events_stmt:
13828 SHOW BINLOG_SYM EVENTS_SYM opt_binlog_in binlog_from opt_limit_clause
13829 {
13830
1/2
✓ Branch 0 taken 16797 times.
✗ Branch 1 not taken.
16797 $$ = NEW_PTN PT_show_binlog_events(@$, $4, $6);
13831 }
13832 ;
13833
13834 show_relaylog_events_stmt:
13835 SHOW RELAYLOG_SYM EVENTS_SYM opt_binlog_in binlog_from opt_limit_clause
13836 opt_channel
13837 {
13838
1/2
✓ Branch 0 taken 1262 times.
✗ Branch 1 not taken.
1262 $$ = NEW_PTN PT_show_relaylog_events(@$, $4, $6, $7);
13839 }
13840 ;
13841
13842 show_keys_stmt:
13843 SHOW /* #1 */
13844 opt_extended /* #2 */
13845 keys_or_index /* #3 */
13846 from_or_in /* #4 */
13847 table_ident /* #5 */
13848 opt_db /* #6 */
13849 opt_where_clause /* #7 */
13850 {
13851 // TODO: error if table_ident is <db>.<table> and opt_db is set.
13852
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1054 times.
1055 if ($6)
13853 1 $5->change_db($6);
13854
13855
1/2
✓ Branch 0 taken 1055 times.
✗ Branch 1 not taken.
1055 $$ = NEW_PTN PT_show_keys(@$, $2, $5, $7);
13856 }
13857 ;
13858
13859 show_engines_stmt:
13860 SHOW opt_storage ENGINES_SYM
13861 {
13862
1/2
✓ Branch 0 taken 243 times.
✗ Branch 1 not taken.
243 $$ = NEW_PTN PT_show_engines(@$);
13863 }
13864 ;
13865
13866 show_count_warnings_stmt:
13867 SHOW COUNT_SYM '(' '*' ')' WARNINGS
13868 {
13869
1/2
✓ Branch 0 taken 6067 times.
✗ Branch 1 not taken.
6067 $$ = NEW_PTN PT_show_count_warnings(@$);
13870 }
13871 ;
13872
13873 show_count_errors_stmt:
13874 SHOW COUNT_SYM '(' '*' ')' ERRORS
13875 {
13876
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 $$ = NEW_PTN PT_show_count_errors(@$);
13877 }
13878 ;
13879
13880 show_warnings_stmt:
13881 SHOW WARNINGS opt_limit_clause
13882 {
13883
1/2
✓ Branch 0 taken 101663 times.
✗ Branch 1 not taken.
101663 $$ = NEW_PTN PT_show_warnings(@$, $3);
13884 }
13885 ;
13886
13887 show_errors_stmt:
13888 SHOW ERRORS opt_limit_clause
13889 {
13890
1/2
✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
77 $$ = NEW_PTN PT_show_errors(@$, $3);
13891 }
13892 ;
13893
13894 show_profiles_stmt:
13895 SHOW PROFILES_SYM
13896 {
13897
2/4
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
✗ Branch 3 not taken.
14 push_warning_printf(YYTHD, Sql_condition::SL_WARNING,
13898 ER_WARN_DEPRECATED_SYNTAX,
13899 ER_THD(YYTHD, ER_WARN_DEPRECATED_SYNTAX),
13900 "SHOW PROFILES", "Performance Schema");
13901
1/2
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
14 $$ = NEW_PTN PT_show_profiles(@$);
13902 }
13903 ;
13904
13905 show_profile_stmt:
13906 SHOW PROFILE_SYM opt_profile_defs opt_for_query opt_limit_clause
13907 {
13908
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
26 $$ = NEW_PTN PT_show_profile(@$, $3, $4, $5);
13909 }
13910 ;
13911
13912 show_status_stmt:
13913 SHOW opt_var_type STATUS_SYM opt_wild_or_where
13914 {
13915
1/2
✓ Branch 0 taken 123674 times.
✗ Branch 1 not taken.
123674 $$ = NEW_PTN PT_show_status(@$, $2, $4.wild, $4.where);
13916 }
13917 ;
13918
13919 show_processlist_stmt:
13920 SHOW opt_full PROCESSLIST_SYM
13921 {
13922
1/2
✓ Branch 0 taken 524 times.
✗ Branch 1 not taken.
524 $$ = NEW_PTN PT_show_processlist(@$, $2);
13923 }
13924 ;
13925
13926 show_variables_stmt:
13927 SHOW opt_var_type VARIABLES opt_wild_or_where
13928 {
13929
1/2
✓ Branch 0 taken 45861 times.
✗ Branch 1 not taken.
45861 $$ = NEW_PTN PT_show_variables(@$, $2, $4.wild, $4.where);
13930 }
13931 ;
13932
13933 show_character_set_stmt:
13934 SHOW character_set opt_wild_or_where
13935 {
13936
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 $$ = NEW_PTN PT_show_charsets(@$, $3.wild, $3.where);
13937 }
13938 ;
13939
13940 show_collation_stmt:
13941 SHOW COLLATION_SYM opt_wild_or_where
13942 {
13943
1/2
✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
49 $$ = NEW_PTN PT_show_collations(@$, $3.wild, $3.where);
13944 }
13945 ;
13946
13947 show_privileges_stmt:
13948 SHOW PRIVILEGES
13949 {
13950
1/2
✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
11 $$ = NEW_PTN PT_show_privileges(@$);
13951 }
13952 ;
13953
13954 show_grants_stmt:
13955 SHOW GRANTS
13956 {
13957
1/2
✓ Branch 0 taken 419 times.
✗ Branch 1 not taken.
419 $$ = NEW_PTN PT_show_grants(@$, nullptr, nullptr, false);
13958 }
13959 | SHOW GRANTS FOR_SYM user
13960 {
13961
1/2
✓ Branch 0 taken 2667 times.
✗ Branch 1 not taken.
2667 $$ = NEW_PTN PT_show_grants(@$, $4, nullptr, false);
13962 }
13963 | SHOW GRANTS FOR_SYM user USING user_list
13964 {
13965
1/2
✓ Branch 0 taken 112 times.
✗ Branch 1 not taken.
112 $$ = NEW_PTN PT_show_grants(@$, $4, $6, false);
13966 }
13967 | SHOW EFFECTIVE_SYM GRANTS
13968 {
13969
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 $$ = NEW_PTN PT_show_grants(@$, nullptr, nullptr, true);
13970 }
13971 | SHOW EFFECTIVE_SYM GRANTS FOR_SYM user
13972 {
13973
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$ = NEW_PTN PT_show_grants(@$, $5, nullptr, true);
13974 }
13975 | SHOW EFFECTIVE_SYM GRANTS FOR_SYM user USING user_list
13976 {
13977 $$ = NEW_PTN PT_show_grants(@$, $5, $7, true);
13978 }
13979 ;
13980
13981 show_create_database_stmt:
13982 SHOW CREATE DATABASE opt_if_not_exists ident
13983 {
13984
1/2
✓ Branch 0 taken 1772 times.
✗ Branch 1 not taken.
1772 $$ = NEW_PTN PT_show_create_database(@$, $4, $5);
13985 }
13986 ;
13987
13988 show_create_table_stmt:
13989 SHOW CREATE TABLE_SYM table_ident
13990 {
13991
1/2
✓ Branch 0 taken 35276 times.
✗ Branch 1 not taken.
35276 $$ = NEW_PTN PT_show_create_table(@$, $4);
13992 }
13993 ;
13994
13995 show_create_view_stmt:
13996 SHOW CREATE VIEW_SYM table_ident
13997 {
13998
1/2
✓ Branch 0 taken 1124 times.
✗ Branch 1 not taken.
1124 $$ = NEW_PTN PT_show_create_view(@$, $4);
13999 }
14000 ;
14001
14002 show_master_status_stmt:
14003 SHOW MASTER_SYM STATUS_SYM
14004 {
14005
1/2
✓ Branch 0 taken 77506 times.
✗ Branch 1 not taken.
77506 $$ = NEW_PTN PT_show_master_status(@$);
14006 }
14007 ;
14008
14009 show_replica_status_stmt:
14010 SHOW replica STATUS_SYM opt_channel
14011 {
14012
2/2
✓ Branch 0 taken 129630 times.
✓ Branch 1 taken 28849 times.
158479 if (Lex->is_replication_deprecated_syntax_used())
14013
1/2
✓ Branch 0 taken 129630 times.
✗ Branch 1 not taken.
129630 push_deprecated_warn(YYTHD, "SHOW SLAVE STATUS", "SHOW REPLICA STATUS");
14014
1/2
✓ Branch 0 taken 158479 times.
✗ Branch 1 not taken.
158479 $$ = NEW_PTN PT_show_replica_status(@$, $4);
14015 }
14016 ;
14017 show_stats_stmt:
14018 SHOW CLIENT_STATS_SYM opt_wild_or_where
14019 {
14020
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$ = NEW_PTN PT_show_client_stats(@$, $3.wild, $3.where);
14021 }
14022 | SHOW USER_STATS_SYM opt_wild_or_where
14023 {
14024
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$ = NEW_PTN PT_show_user_stats(@$, $3.wild, $3.where);
14025 }
14026 | SHOW THREAD_STATS_SYM opt_wild_or_where
14027 {
14028
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$ = NEW_PTN PT_show_thread_stats(@$, $3.wild, $3.where);
14029 }
14030 | SHOW TABLE_STATS_SYM opt_wild_or_where
14031 {
14032
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$ = NEW_PTN PT_show_table_stats(@$, $3.wild, $3.where);
14033 }
14034 | SHOW INDEX_STATS_SYM opt_wild_or_where
14035 {
14036
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$ = NEW_PTN PT_show_index_stats(@$, $3.wild, $3.where);
14037 }
14038 ;
14039
14040 show_create_procedure_stmt:
14041 SHOW CREATE PROCEDURE_SYM sp_name
14042 {
14043
1/2
✓ Branch 0 taken 592 times.
✗ Branch 1 not taken.
592 $$ = NEW_PTN PT_show_create_procedure(@$, $4);
14044 }
14045 ;
14046
14047 show_create_function_stmt:
14048 SHOW CREATE FUNCTION_SYM sp_name
14049 {
14050
1/2
✓ Branch 0 taken 404 times.
✗ Branch 1 not taken.
404 $$ = NEW_PTN PT_show_create_function(@$, $4);
14051 }
14052 ;
14053
14054 show_create_trigger_stmt:
14055 SHOW CREATE TRIGGER_SYM sp_name
14056 {
14057
1/2
✓ Branch 0 taken 518 times.
✗ Branch 1 not taken.
518 $$ = NEW_PTN PT_show_create_trigger(@$, $4);
14058 }
14059 ;
14060
14061 show_procedure_status_stmt:
14062 SHOW PROCEDURE_SYM STATUS_SYM opt_wild_or_where
14063 {
14064
1/2
✓ Branch 0 taken 451 times.
✗ Branch 1 not taken.
451 $$ = NEW_PTN PT_show_status_proc(@$, $4.wild, $4.where);
14065 }
14066 ;
14067
14068 show_function_status_stmt:
14069 SHOW FUNCTION_SYM STATUS_SYM opt_wild_or_where
14070 {
14071
1/2
✓ Branch 0 taken 420 times.
✗ Branch 1 not taken.
420 $$ = NEW_PTN PT_show_status_func(@$, $4.wild, $4.where);
14072 }
14073 ;
14074
14075 show_procedure_code_stmt:
14076 SHOW PROCEDURE_SYM CODE_SYM sp_name
14077 {
14078
1/2
✓ Branch 0 taken 47 times.
✗ Branch 1 not taken.
47 $$ = NEW_PTN PT_show_procedure_code(@$, $4);
14079 }
14080 ;
14081
14082 show_function_code_stmt:
14083 SHOW FUNCTION_SYM CODE_SYM sp_name
14084 {
14085
1/2
✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
35 $$ = NEW_PTN PT_show_function_code(@$, $4);
14086 }
14087 ;
14088
14089 show_create_event_stmt:
14090 SHOW CREATE EVENT_SYM sp_name
14091 {
14092
1/2
✓ Branch 0 taken 319 times.
✗ Branch 1 not taken.
319 $$ = NEW_PTN PT_show_create_event(@$, $4);
14093 }
14094 ;
14095
14096 show_create_user_stmt:
14097 SHOW CREATE USER user
14098 {
14099
1/2
✓ Branch 0 taken 1141 times.
✗ Branch 1 not taken.
1141 $$ = NEW_PTN PT_show_create_user(@$, $4);
14100 }
14101 ;
14102
14103 engine_or_all:
14104 ident_or_text
14105 6 | ALL { $$ = {}; }
14106 ;
14107
14108 master_or_binary:
14109 MASTER_SYM
14110 | BINARY_SYM
14111 ;
14112
14113 opt_storage:
14114 /* empty */
14115 | STORAGE_SYM
14116 ;
14117
14118 opt_db:
14119 39206 /* empty */ { $$= 0; }
14120 6110 | from_or_in ident { $$= $2.str; }
14121 ;
14122
14123 opt_full:
14124 5174 /* empty */ { $$= 0; }
14125 18 | FULL { $$= 1; }
14126 ;
14127
14128 opt_extended:
14129 1067 /* empty */ { $$= 0; }
14130 1 | EXTENDED_SYM { $$= 1; }
14131 ;
14132
14133 opt_show_cmd_type:
14134 34979 /* empty */ { $$= Show_cmd_type::STANDARD; }
14135 164 | FULL { $$= Show_cmd_type::FULL_SHOW; }
14136 15 | EXTENDED_SYM { $$= Show_cmd_type::EXTENDED_SHOW; }
14137 3 | EXTENDED_SYM FULL { $$= Show_cmd_type::EXTENDED_FULL_SHOW; }
14138 ;
14139
14140 from_or_in:
14141 FROM
14142 | IN_SYM
14143 ;
14144
14145 opt_binlog_in:
14146 3775 /* empty */ { $$ = {}; }
14147 14284 | IN_SYM TEXT_STRING_sys { $$ = $2; }
14148 ;
14149
14150 binlog_from:
14151 3941 /* empty */ { Lex->mi.pos = 4; /* skip magic number */ }
14152 14118 | FROM ulonglong_num { Lex->mi.pos = $2; }
14153 ;
14154
14155 opt_wild_or_where:
14156 77204 /* empty */ { $$ = {}; }
14157 135526 | LIKE TEXT_STRING_literal { $$ = { $2, {} }; }
14158 2414 | where_clause { $$ = { {}, $1 }; }
14159 ;
14160
14161 /* A Oracle compatible synonym for show */
14162 describe_stmt:
14163 describe_command table_ident opt_describe_column
14164 {
14165
1/2
✓ Branch 0 taken 779 times.
✗ Branch 1 not taken.
779 $$= NEW_PTN PT_show_fields(@$, Show_cmd_type::STANDARD, $2, $3);
14166 }
14167 ;
14168
14169 explain_stmt:
14170 describe_command opt_explain_analyze_type explainable_stmt
14171 {
14172
1/2
✓ Branch 0 taken 29204 times.
✗ Branch 1 not taken.
29204 $$= NEW_PTN PT_explain($2, $3);
14173 }
14174 ;
14175
14176 explainable_stmt:
14177 select_stmt
14178 | insert_stmt
14179 | replace_stmt
14180 | update_stmt
14181 | delete_stmt
14182 | FOR_SYM CONNECTION_SYM real_ulong_num
14183 {
14184
1/2
✓ Branch 0 taken 172 times.
✗ Branch 1 not taken.
172 $$= NEW_PTN PT_explain_for_connection(static_cast<my_thread_id>($3));
14185 }
14186 ;
14187
14188 describe_command:
14189 DESC
14190 | DESCRIBE
14191 ;
14192
14193 opt_explain_format_type:
14194 /* empty */
14195 {
14196 27322 $$= Explain_format_type::DEFAULT;
14197 }
14198 | FORMAT_SYM EQ ident_or_text
14199 {
14200
3/4
✓ Branch 0 taken 1899 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1071 times.
✓ Branch 3 taken 828 times.
1899 if (is_identifier($3, "JSON"))
14201 1071 $$= Explain_format_type::JSON;
14202
3/4
✓ Branch 0 taken 828 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 132 times.
✓ Branch 3 taken 696 times.
828 else if (is_identifier($3, "TRADITIONAL"))
14203 132 $$= Explain_format_type::TRADITIONAL;
14204
3/4
✓ Branch 0 taken 696 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 694 times.
✓ Branch 3 taken 2 times.
696 else if (is_identifier($3, "TREE"))
14205 694 $$= Explain_format_type::TREE;
14206 else
14207 {
14208
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0), $3.str);
14209 2 MYSQL_YYABORT;
14210 }
14211 }
14212
14213 opt_explain_analyze_type:
14214 ANALYZE_SYM opt_explain_format_type
14215 {
14216
3/3
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
26 switch ($2)
14217 {
14218 24 case Explain_format_type::DEFAULT:
14219 case Explain_format_type::TREE:
14220 24 $$= Explain_format_type::TREE_WITH_EXECUTE;
14221 24 break;
14222 1 case Explain_format_type::JSON:
14223
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_NOT_SUPPORTED_YET, MYF(0),
14224 "FORMAT=JSON with EXPLAIN ANALYZE");
14225 1 MYSQL_YYABORT;
14226 1 default:
14227
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_NOT_SUPPORTED_YET, MYF(0),
14228 "FORMAT=TRADITIONAL with EXPLAIN ANALYZE");
14229 1 MYSQL_YYABORT;
14230 }
14231 }
14232 | opt_explain_format_type
14233 {
14234
2/2
✓ Branch 0 taken 27299 times.
✓ Branch 1 taken 1894 times.
29193 if ($1 == Explain_format_type::DEFAULT)
14235 27299 $$= Explain_format_type::TRADITIONAL;
14236 else
14237 1894 $$= $1;
14238 }
14239 ;
14240
14241 opt_describe_column:
14242 775 /* empty */ { $$= LEX_STRING{ nullptr, 0 }; }
14243 | text_string
14244 {
14245 if ($1 != nullptr)
14246 $$= $1->lex_string();
14247 }
14248 | ident
14249 ;
14250
14251
14252 /* flush things */
14253
14254 flush:
14255 FLUSH_SYM opt_no_write_to_binlog
14256 {
14257 22230 LEX *lex=Lex;
14258 22230 lex->sql_command= SQLCOM_FLUSH;
14259 22230 lex->type= 0;
14260 22230 lex->no_write_to_binlog= $2;
14261 }
14262 flush_options
14263 {}
14264 ;
14265
14266 flush_options:
14267 table_or_tables opt_table_list
14268 {
14269 13323 Lex->type|= REFRESH_TABLES;
14270 /*
14271 Set type of metadata and table locks for
14272 FLUSH TABLES table_list [WITH READ LOCK].
14273 */
14274 13323 YYPS->m_lock_type= TL_READ_NO_INSERT;
14275 13323 YYPS->m_mdl_type= MDL_SHARED_HIGH_PRIO;
14276
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 13323 times.
26646 if (Select->add_tables(YYTHD, $2, TL_OPTION_UPDATING,
14277
1/2
✓ Branch 0 taken 13323 times.
✗ Branch 1 not taken.
13323 YYPS->m_lock_type, YYPS->m_mdl_type))
14278 MYSQL_YYABORT;
14279 }
14280 opt_flush_lock {}
14281 | flush_options_list
14282 ;
14283
14284 opt_flush_lock:
14285 /* empty */ {}
14286 | WITH READ_SYM LOCK_SYM
14287 {
14288 713 TABLE_LIST *tables= Lex->query_tables;
14289 713 Lex->type|= REFRESH_READ_LOCK;
14290
2/2
✓ Branch 0 taken 94 times.
✓ Branch 1 taken 713 times.
807 for (; tables; tables= tables->next_global)
14291 {
14292 94 tables->mdl_request.set_type(MDL_SHARED_NO_WRITE);
14293 /* Don't try to flush views. */
14294 94 tables->required_type= dd::enum_table_type::BASE_TABLE;
14295 94 tables->open_type= OT_BASE_ONLY; /* Ignore temporary tables. */
14296 }
14297 }
14298 | FOR_SYM
14299 {
14300
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 339 times.
340 if (Lex->query_tables == NULL) // Table list can't be empty
14301 {
14302
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error(ER_NO_TABLES_USED);
14303 1 MYSQL_YYABORT;
14304 }
14305 }
14306 EXPORT_SYM
14307 {
14308 339 TABLE_LIST *tables= Lex->query_tables;
14309 339 Lex->type|= REFRESH_FOR_EXPORT;
14310
2/2
✓ Branch 0 taken 357 times.
✓ Branch 1 taken 339 times.
696 for (; tables; tables= tables->next_global)
14311 {
14312 357 tables->mdl_request.set_type(MDL_SHARED_NO_WRITE);
14313 /* Don't try to flush views. */
14314 357 tables->required_type= dd::enum_table_type::BASE_TABLE;
14315 357 tables->open_type= OT_BASE_ONLY; /* Ignore temporary tables. */
14316 }
14317 }
14318 ;
14319
14320 flush_options_list:
14321 flush_options_list ',' flush_option
14322 | flush_option
14323 {}
14324 ;
14325
14326 flush_option:
14327 ERROR_SYM LOGS_SYM
14328 81 { Lex->type|= REFRESH_ERROR_LOG; }
14329 | ENGINE_SYM LOGS_SYM
14330 305 { Lex->type|= REFRESH_ENGINE_LOG; }
14331 | GENERAL LOGS_SYM
14332 67 { Lex->type|= REFRESH_GENERAL_LOG; }
14333 | SLOW LOGS_SYM
14334 67 { Lex->type|= REFRESH_SLOW_LOG; }
14335 | BINARY_SYM LOGS_SYM
14336 328 { Lex->type|= REFRESH_BINARY_LOG; }
14337 | RELAY LOGS_SYM opt_channel
14338 {
14339 139 Lex->type|= REFRESH_RELAY_LOG;
14340
2/4
✓ Branch 0 taken 139 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 139 times.
139 if (Lex->set_channel_name($3))
14341 MYSQL_YYABORT; // OOM
14342 }
14343 | HOSTS_SYM
14344 75 { Lex->type|= REFRESH_HOSTS; }
14345 | PRIVILEGES
14346 2461 { Lex->type|= REFRESH_GRANT; }
14347 | LOGS_SYM
14348 1510 { Lex->type|= REFRESH_LOG; }
14349 | STATUS_SYM
14350 3364 { Lex->type|= REFRESH_STATUS; }
14351 | CLIENT_STATS_SYM
14352 64 { Lex->type|= REFRESH_CLIENT_STATS; }
14353 | USER_STATS_SYM
14354 65 { Lex->type|= REFRESH_USER_STATS; }
14355 | THREAD_STATS_SYM
14356 63 { Lex->type|= REFRESH_THREAD_STATS; }
14357 | TABLE_STATS_SYM
14358 64 { Lex->type|= REFRESH_TABLE_STATS; }
14359 | INDEX_STATS_SYM
14360 64 { Lex->type|= REFRESH_INDEX_STATS; }
14361 | RESOURCES
14362 125 { Lex->type|= REFRESH_USER_RESOURCES; }
14363 | OPTIMIZER_COSTS_SYM
14364 75 { Lex->type|= REFRESH_OPTIMIZER_COSTS; }
14365 | MEMORY_SYM PROFILE_SYM
14366 { Lex->type|= DUMP_MEMORY_PROFILE; }
14367 ;
14368
14369 opt_table_list:
14370 12612 /* empty */ { $$= NULL; }
14371 | table_list
14372 ;
14373
14374 reset:
14375 RESET_SYM
14376 {
14377 22209 LEX *lex=Lex;
14378 22209 lex->sql_command= SQLCOM_RESET; lex->type=0;
14379 }
14380 reset_options
14381 {}
14382 | RESET_SYM PERSIST_SYM opt_if_exists_ident
14383 {
14384 3853 LEX *lex=Lex;
14385 3853 lex->sql_command= SQLCOM_RESET;
14386 3853 lex->type|= REFRESH_PERSIST;
14387 3853 lex->option_type= OPT_PERSIST;
14388 }
14389 ;
14390
14391 reset_options:
14392 reset_options ',' reset_option
14393 | reset_option
14394 ;
14395
14396 opt_if_exists_ident:
14397 /* empty */
14398 {
14399 84 LEX *lex=Lex;
14400 84 lex->drop_if_exists= false;
14401 84 lex->name= NULL_STR;
14402 }
14403 | if_exists ident
14404 {
14405 3769 LEX *lex=Lex;
14406 3769 lex->drop_if_exists= $1;
14407 3769 lex->name= $2;
14408 }
14409 ;
14410
14411 reset_option:
14412 SLAVE
14413 {
14414 1019 Lex->type|= REFRESH_SLAVE;
14415 1019 Lex->set_replication_deprecated_syntax_used();
14416
1/2
✓ Branch 0 taken 1019 times.
✗ Branch 1 not taken.
1019 push_deprecated_warn(YYTHD, "RESET SLAVE", "RESET REPLICA");
14417 }
14418 opt_replica_reset_options opt_channel
14419 {
14420
2/4
✓ Branch 0 taken 1019 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1019 times.
1019 if (Lex->set_channel_name($4))
14421 MYSQL_YYABORT; // OOM
14422 }
14423 | REPLICA_SYM
14424 11898 { Lex->type|= REFRESH_REPLICA; }
14425 opt_replica_reset_options opt_channel
14426 {
14427
2/4
✓ Branch 0 taken 11898 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 11898 times.
11898 if (Lex->set_channel_name($4))
14428 MYSQL_YYABORT; // OOM
14429 }
14430 | MASTER_SYM
14431 {
14432 9292 Lex->type|= REFRESH_MASTER;
14433 /*
14434 Reset Master should acquire global read lock
14435 in order to avoid any parallel transaction commits
14436 while the reset operation is going on.
14437
14438 *Only if* the thread is not already acquired the global
14439 read lock, server will acquire global read lock
14440 during the operation and release it at the
14441 end of the reset operation.
14442 */
14443
2/2
✓ Branch 0 taken 9287 times.
✓ Branch 1 taken 5 times.
9292 if (!(YYTHD)->global_read_lock.is_acquired())
14444 9287 Lex->type|= REFRESH_TABLES | REFRESH_READ_LOCK;
14445 }
14446 source_reset_options
14447 ;
14448
14449 opt_replica_reset_options:
14450 1020 /* empty */ { Lex->reset_slave_info.all= false; }
14451 11897 | ALL { Lex->reset_slave_info.all= true; }
14452 ;
14453
14454 source_reset_options:
14455 /* empty */ {}
14456 | TO_SYM real_ulonglong_num
14457 {
14458
4/4
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 7 times.
12 if ($2 == 0 || $2 > MAX_ALLOWED_FN_EXT_RESET_MASTER)
14459 {
14460
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 my_error(ER_RESET_MASTER_TO_VALUE_OUT_OF_RANGE, MYF(0),
14461 $2, MAX_ALLOWED_FN_EXT_RESET_MASTER);
14462 5 MYSQL_YYABORT;
14463 }
14464 else
14465 7 Lex->next_binlog_file_nr = $2;
14466 }
14467 ;
14468
14469 purge:
14470 PURGE
14471 {
14472 148 LEX *lex=Lex;
14473 148 lex->type=0;
14474 148 lex->sql_command = SQLCOM_PURGE;
14475 }
14476 purge_options
14477 {}
14478 ;
14479
14480 purge_options:
14481 master_or_binary LOGS_SYM purge_option
14482 ;
14483
14484 purge_option:
14485 TO_SYM TEXT_STRING_sys
14486 {
14487 111 Lex->to_log = $2.str;
14488 }
14489 | BEFORE_SYM expr
14490 {
14491
9/14
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 36 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 36 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 36 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 10 times.
✓ Branch 11 taken 26 times.
✓ Branch 12 taken 10 times.
✓ Branch 13 taken 26 times.
36 ITEMIZE($2, &$2);
14492
14493 26 LEX *lex= Lex;
14494 26 lex->purge_value_list.clear();
14495
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
26 lex->purge_value_list.push_front($2);
14496 26 lex->sql_command= SQLCOM_PURGE_BEFORE;
14497 }
14498 ;
14499
14500 /* kill threads */
14501
14502 kill:
14503 KILL_SYM kill_option expr
14504 {
14505
7/14
✓ Branch 0 taken 2561 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2561 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2561 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2561 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2561 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2561 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 2561 times.
2561 ITEMIZE($3, &$3);
14506
14507 2561 LEX *lex=Lex;
14508 2561 lex->kill_value_list.clear();
14509
1/2
✓ Branch 0 taken 2561 times.
✗ Branch 1 not taken.
2561 lex->kill_value_list.push_front($3);
14510 2561 lex->sql_command= SQLCOM_KILL;
14511 }
14512 ;
14513
14514 kill_option:
14515 2309 /* empty */ { Lex->type= 0; }
14516 40 | CONNECTION_SYM { Lex->type= 0; }
14517 213 | QUERY_SYM { Lex->type= ONLY_KILL_QUERY; }
14518 ;
14519
14520 /* change database */
14521
14522 use:
14523 USE_SYM ident
14524 {
14525 89898 LEX *lex=Lex;
14526 89898 lex->sql_command=SQLCOM_CHANGE_DB;
14527 89898 lex->query_block->db= $2.str;
14528 }
14529 ;
14530
14531 /* import, export of files */
14532
14533 load_stmt:
14534 LOAD /* 1 */
14535 data_or_xml /* 2 */
14536 load_data_lock /* 3 */
14537 opt_local /* 4 */
14538 INFILE /* 5 */
14539 TEXT_STRING_filesystem /* 6 */
14540 opt_duplicate /* 7 */
14541 INTO /* 8 */
14542 TABLE_SYM /* 9 */
14543 table_ident /* 10 */
14544 opt_use_partition /* 11 */
14545 opt_load_data_charset /* 12 */
14546 opt_xml_rows_identified_by /* 13 */
14547 opt_field_term /* 14 */
14548 opt_line_term /* 15 */
14549 opt_ignore_lines /* 16 */
14550 opt_field_or_var_spec /* 17 */
14551 opt_load_data_set_spec /* 18 */
14552 {
14553
1/2
✓ Branch 0 taken 40805 times.
✗ Branch 1 not taken.
81610 $$= NEW_PTN PT_load_table($2, // data_or_xml
14554 40805 $3, // load_data_lock
14555 40805 $4, // opt_local
14556 40805 $6, // TEXT_STRING_filesystem
14557 40805 $7, // opt_duplicate
14558 40805 $10, // table_ident
14559 40805 $11, // opt_use_partition
14560 40805 $12, // opt_load_data_charset
14561 40805 $13, // opt_xml_rows_identified_by
14562 40805 $14, // opt_field_term
14563 40805 $15, // opt_line_term
14564 40805 $16, // opt_ignore_lines
14565 40805 $17, // opt_field_or_var_spec
14566 $18.set_var_list,// opt_load_data_set_spec
14567 $18.set_expr_list,
14568
1/2
✓ Branch 0 taken 40805 times.
✗ Branch 1 not taken.
81610 $18.set_expr_str_list);
14569 }
14570 ;
14571
14572 data_or_xml:
14573 40760 DATA_SYM{ $$= FILETYPE_CSV; }
14574 46 | XML_SYM { $$= FILETYPE_XML; }
14575 ;
14576
14577 opt_local:
14578 39553 /* empty */ { $$= false; }
14579 1253 | LOCAL_SYM { $$= true; }
14580 ;
14581
14582 load_data_lock:
14583 40220 /* empty */ { $$= TL_WRITE_DEFAULT; }
14584 305 | CONCURRENT { $$= TL_WRITE_CONCURRENT_INSERT; }
14585 281 | LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; }
14586 ;
14587
14588 opt_duplicate:
14589 40689 /* empty */ { $$= On_duplicate::ERROR; }
14590 | duplicate
14591 ;
14592
14593 duplicate:
14594 29 REPLACE_SYM { $$= On_duplicate::REPLACE_DUP; }
14595 101 | IGNORE_SYM { $$= On_duplicate::IGNORE_DUP; }
14596 ;
14597
14598 opt_field_term:
14599 40279 /* empty */ { $$.cleanup(); }
14600 15533 | COLUMNS field_term_list { $$= $2; }
14601 ;
14602
14603 field_term_list:
14604 field_term_list field_term
14605 {
14606 14660 $$= $1;
14607 14660 $$.merge_field_separators($2);
14608 }
14609 | field_term
14610 ;
14611
14612 field_term:
14613 TERMINATED BY text_string
14614 {
14615 13826 $$.cleanup();
14616 13826 $$.field_term= $3;
14617 }
14618 | OPTIONALLY ENCLOSED BY text_string
14619 {
14620 1709 $$.cleanup();
14621 1709 $$.enclosed= $4;
14622 1709 $$.opt_enclosed= 1;
14623 }
14624 | ENCLOSED BY text_string
14625 {
14626 1869 $$.cleanup();
14627 1869 $$.enclosed= $3;
14628 }
14629 | ESCAPED BY text_string
14630 {
14631 12789 $$.cleanup();
14632 12789 $$.escaped= $3;
14633 }
14634 ;
14635
14636 opt_line_term:
14637 53101 /* empty */ { $$.cleanup(); }
14638 2711 | LINES line_term_list { $$= $2; }
14639 ;
14640
14641 line_term_list:
14642 line_term_list line_term
14643 {
14644 16 $$= $1;
14645 16 $$.merge_line_separators($2);
14646 }
14647 | line_term
14648 ;
14649
14650 line_term:
14651 TERMINATED BY text_string
14652 {
14653 2701 $$.cleanup();
14654 2701 $$.line_term= $3;
14655 }
14656 | STARTING BY text_string
14657 {
14658 26 $$.cleanup();
14659 26 $$.line_start= $3;
14660 }
14661 ;
14662
14663 opt_xml_rows_identified_by:
14664 40794 /* empty */ { $$= nullptr; }
14665 11 | ROWS_SYM IDENTIFIED_SYM BY text_string { $$= $4; }
14666 ;
14667
14668 opt_ignore_lines:
14669 28079 /* empty */ { $$= 0; }
14670 12726 | IGNORE_SYM NUM lines_or_rows { $$= atol($2.str); }
14671 ;
14672
14673 lines_or_rows:
14674 LINES
14675 | ROWS_SYM
14676 ;
14677
14678 opt_field_or_var_spec:
14679 27921 /* empty */ { $$= nullptr; }
14680 12883 | '(' fields_or_vars ')' { $$= $2; }
14681 1 | '(' ')' { $$= nullptr; }
14682 ;
14683
14684 fields_or_vars:
14685 fields_or_vars ',' field_or_var
14686 {
14687 175 $$= $1;
14688
2/4
✓ Branch 0 taken 175 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 175 times.
175 if ($$->push_back($3))
14689 MYSQL_YYABORT; // OOM
14690 }
14691 | field_or_var
14692 {
14693
2/4
✓ Branch 0 taken 12882 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12882 times.
✗ Branch 3 not taken.
12882 $$= NEW_PTN PT_item_list;
14694
4/8
✓ Branch 0 taken 12882 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12882 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 12882 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 12882 times.
12882 if ($$ == nullptr || $$->push_back($1))
14695 MYSQL_YYABORT; // OOM
14696 }
14697 ;
14698
14699 field_or_var:
14700 simple_ident_nospvar
14701 | '@' ident_or_text
14702 {
14703
2/4
✓ Branch 0 taken 62 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 62 times.
✗ Branch 3 not taken.
62 $$= NEW_PTN Item_user_var_as_out_param(@$, $2);
14704 }
14705 ;
14706
14707 opt_load_data_set_spec:
14708 40740 /* empty */ { $$= {nullptr, nullptr, nullptr}; }
14709 65 | SET_SYM load_data_set_list { $$= $2; }
14710 ;
14711
14712 load_data_set_list:
14713 load_data_set_list ',' load_data_set_elem
14714 {
14715 5 $$= $1;
14716
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 if ($$.set_var_list->push_back($3.set_var) ||
14717
4/8
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5 times.
10 $$.set_expr_list->push_back($3.set_expr) ||
14718
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
5 $$.set_expr_str_list->push_back($3.set_expr_str))
14719 MYSQL_YYABORT; // OOM
14720 }
14721 | load_data_set_elem
14722 {
14723
2/4
✓ Branch 0 taken 65 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 65 times.
✗ Branch 3 not taken.
65 $$.set_var_list= NEW_PTN PT_item_list;
14724
2/4
✓ Branch 0 taken 65 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 65 times.
130 if ($$.set_var_list == nullptr ||
14725
2/4
✓ Branch 0 taken 65 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 65 times.
65 $$.set_var_list->push_back($1.set_var))
14726 MYSQL_YYABORT; // OOM
14727
14728
2/4
✓ Branch 0 taken 65 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 65 times.
✗ Branch 3 not taken.
65 $$.set_expr_list= NEW_PTN PT_item_list;
14729
2/4
✓ Branch 0 taken 65 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 65 times.
130 if ($$.set_expr_list == nullptr ||
14730
2/4
✓ Branch 0 taken 65 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 65 times.
65 $$.set_expr_list->push_back($1.set_expr))
14731 MYSQL_YYABORT; // OOM
14732
14733
1/2
✓ Branch 0 taken 65 times.
✗ Branch 1 not taken.
65 $$.set_expr_str_list= NEW_PTN List<String>;
14734
2/4
✓ Branch 0 taken 65 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 65 times.
130 if ($$.set_expr_str_list == nullptr ||
14735
2/4
✓ Branch 0 taken 65 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 65 times.
65 $$.set_expr_str_list->push_back($1.set_expr_str))
14736 MYSQL_YYABORT; // OOM
14737 }
14738 ;
14739
14740 load_data_set_elem:
14741 simple_ident_nospvar equal expr_or_default
14742 {
14743 70 size_t length= @3.cpp.end - @2.cpp.start;
14744
14745
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 70 times.
70 if ($3 == nullptr)
14746 MYSQL_YYABORT; // OOM
14747
1/2
✓ Branch 0 taken 70 times.
✗ Branch 1 not taken.
70 $3->item_name.copy(@2.cpp.start, length, YYTHD->charset());
14748
14749 70 $$.set_var= $1;
14750 70 $$.set_expr= $3;
14751 140 $$.set_expr_str= NEW_PTN String(@2.cpp.start,
14752 length,
14753
1/2
✓ Branch 0 taken 70 times.
✗ Branch 1 not taken.
70 YYTHD->charset());
14754
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 70 times.
70 if ($$.set_expr_str == nullptr)
14755 MYSQL_YYABORT; // OOM
14756 }
14757 ;
14758
14759 /* Common definitions */
14760
14761 text_literal:
14762 TEXT_STRING
14763 {
14764
1/2
✓ Branch 0 taken 32104752 times.
✗ Branch 1 not taken.
64209511 $$= NEW_PTN PTI_text_literal_text_string(@$,
14765
1/2
✓ Branch 0 taken 32104759 times.
✗ Branch 1 not taken.
64209459 YYTHD->m_parser_state->m_lip.text_string_is_7bit(), $1);
14766 }
14767 | NCHAR_STRING
14768 {
14769
1/2
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
72 $$= NEW_PTN PTI_text_literal_nchar_string(@$,
14770
1/2
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
72 YYTHD->m_parser_state->m_lip.text_string_is_7bit(), $1);
14771
1/2
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
36 warn_about_deprecated_national(YYTHD);
14772 }
14773 | UNDERSCORE_CHARSET TEXT_STRING
14774 {
14775
1/2
✓ Branch 0 taken 190768 times.
✗ Branch 1 not taken.
381536 $$= NEW_PTN PTI_text_literal_underscore_charset(@$,
14776
1/2
✓ Branch 0 taken 190768 times.
✗ Branch 1 not taken.
381536 YYTHD->m_parser_state->m_lip.text_string_is_7bit(), $1, $2);
14777 }
14778 | text_literal TEXT_STRING_literal
14779 {
14780
1/2
✓ Branch 0 taken 6781 times.
✗ Branch 1 not taken.
13562 $$= NEW_PTN PTI_text_literal_concat(@$,
14781
1/2
✓ Branch 0 taken 6781 times.
✗ Branch 1 not taken.
13562 YYTHD->m_parser_state->m_lip.text_string_is_7bit(), $1, $2);
14782 }
14783 ;
14784
14785 text_string:
14786 TEXT_STRING_literal
14787 {
14788 3563737 $$= NEW_PTN String($1.str, $1.length,
14789
1/2
✓ Branch 0 taken 3563737 times.
✗ Branch 1 not taken.
3563737 YYTHD->variables.collation_connection);
14790
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3563737 times.
3563737 if ($$ == NULL)
14791 MYSQL_YYABORT;
14792 }
14793 | HEX_NUM
14794 {
14795
1/2
✓ Branch 0 taken 2625 times.
✗ Branch 1 not taken.
2625 LEX_CSTRING s= Item_hex_string::make_hex_str($1.str, $1.length);
14796
1/2
✓ Branch 0 taken 2625 times.
✗ Branch 1 not taken.
2625 $$= NEW_PTN String(s.str, s.length, &my_charset_bin);
14797
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2625 times.
2625 if ($$ == NULL)
14798 MYSQL_YYABORT;
14799 }
14800 | BIN_NUM
14801 {
14802
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 LEX_CSTRING s= Item_bin_string::make_bin_str($1.str, $1.length);
14803
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 $$= NEW_PTN String(s.str, s.length, &my_charset_bin);
14804
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if ($$ == NULL)
14805 MYSQL_YYABORT;
14806 }
14807 ;
14808
14809 param_marker:
14810 PARAM_MARKER
14811 {
14812 auto *i= NEW_PTN Item_param(@$, YYMEM_ROOT,
14813
2/4
✓ Branch 0 taken 284850 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 284850 times.
✗ Branch 3 not taken.
284851 (uint) (@1.raw.start - YYLIP->get_buf()));
14814
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 284850 times.
284850 if (i == NULL)
14815 MYSQL_YYABORT;
14816 284850 auto *lex= Lex;
14817 /*
14818 If we are not re-parsing a CTE definition, this is a
14819 real parameter, so add it to param_list.
14820 */
14821
3/4
✓ Branch 0 taken 284842 times.
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 284850 times.
569692 if (!lex->reparse_common_table_expr_at &&
14822
2/4
✓ Branch 0 taken 284842 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 284842 times.
284842 lex->param_list.push_back(i))
14823 MYSQL_YYABORT;
14824 284850 $$= i;
14825 }
14826 ;
14827
14828 signed_literal:
14829 literal
14830 | '+' NUM_literal { $$= $2; }
14831 | '-' NUM_literal
14832 {
14833
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 130 times.
130 if ($2 == NULL)
14834 MYSQL_YYABORT; // OOM
14835 130 $2->max_length++;
14836
1/2
✓ Branch 0 taken 130 times.
✗ Branch 1 not taken.
130 $$= $2->neg();
14837 }
14838 ;
14839
14840 signed_literal_or_null:
14841 signed_literal
14842 | null_as_literal
14843 ;
14844
14845 null_as_literal:
14846 NULL_SYM
14847 {
14848 7275422 Lex_input_stream *lip= YYLIP;
14849 /*
14850 For the digest computation, in this context only,
14851 NULL is considered a literal, hence reduced to '?'
14852 REDUCE:
14853 TOK_GENERIC_VALUE := NULL_SYM
14854 */
14855
1/2
✓ Branch 0 taken 7275422 times.
✗ Branch 1 not taken.
7275422 lip->reduce_digest_token(TOK_GENERIC_VALUE, NULL_SYM);
14856
2/4
✓ Branch 0 taken 7275422 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7275423 times.
✗ Branch 3 not taken.
7275422 $$= NEW_PTN Item_null(@$);
14857 }
14858 ;
14859
14860 literal:
14861 32271293 text_literal { $$= $1; }
14862 30811299 | NUM_literal { $$= $1; }
14863 | temporal_literal
14864 | FALSE_SYM
14865 {
14866
2/4
✓ Branch 0 taken 218818 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 218818 times.
✗ Branch 3 not taken.
218818 $$= NEW_PTN Item_func_false(@$);
14867 }
14868 | TRUE_SYM
14869 {
14870
2/4
✓ Branch 0 taken 144116 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 144116 times.
✗ Branch 3 not taken.
144116 $$= NEW_PTN Item_func_true(@$);
14871 }
14872 | HEX_NUM
14873 {
14874
2/4
✓ Branch 0 taken 21071 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21071 times.
✗ Branch 3 not taken.
21071 $$= NEW_PTN Item_hex_string(@$, $1);
14875 }
14876 | BIN_NUM
14877 {
14878
2/4
✓ Branch 0 taken 6171 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6171 times.
✗ Branch 3 not taken.
6171 $$= NEW_PTN Item_bin_string(@$, $1);
14879 }
14880 | UNDERSCORE_CHARSET HEX_NUM
14881 {
14882
2/4
✓ Branch 0 taken 8509 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8509 times.
✗ Branch 3 not taken.
8509 $$= NEW_PTN PTI_literal_underscore_charset_hex_num(@$, $1, $2);
14883 }
14884 | UNDERSCORE_CHARSET BIN_NUM
14885 {
14886
2/4
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
12 $$= NEW_PTN PTI_literal_underscore_charset_bin_num(@$, $1, $2);
14887 }
14888 ;
14889
14890 literal_or_null:
14891 literal
14892 | null_as_literal
14893 ;
14894
14895 NUM_literal:
14896 int64_literal
14897 | DECIMAL_NUM
14898 {
14899
2/4
✓ Branch 0 taken 254274 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 254273 times.
✗ Branch 3 not taken.
254267 $$= NEW_PTN Item_decimal(@$, $1.str, $1.length, YYCSCL);
14900 }
14901 | FLOAT_NUM
14902 {
14903
2/4
✓ Branch 0 taken 7097 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7097 times.
✗ Branch 3 not taken.
7097 $$= NEW_PTN Item_float(@$, $1.str, $1.length);
14904 }
14905 ;
14906
14907 /*
14908 int64_literal if for unsigned exact integer literals in a range of
14909 [0 .. 2^64-1].
14910 */
14911 int64_literal:
14912
2/4
✓ Branch 0 taken 29936461 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29936775 times.
✗ Branch 3 not taken.
29936312 NUM { $$ = NEW_PTN Item_int(@$, $1); }
14913
2/4
✓ Branch 0 taken 612217 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 612216 times.
✗ Branch 3 not taken.
612215 | LONG_NUM { $$ = NEW_PTN Item_int(@$, $1); }
14914
2/4
✓ Branch 0 taken 3396 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3396 times.
✗ Branch 3 not taken.
3396 | ULONGLONG_NUM { $$ = NEW_PTN Item_uint(@$, $1.str, $1.length); }
14915 ;
14916
14917
14918 temporal_literal:
14919 DATE_SYM TEXT_STRING
14920 {
14921
2/4
✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 152 times.
✗ Branch 3 not taken.
152 $$= NEW_PTN PTI_temporal_literal(@$, $2, MYSQL_TYPE_DATE, YYCSCL);
14922 }
14923 | TIME_SYM TEXT_STRING
14924 {
14925
2/4
✓ Branch 0 taken 395 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 395 times.
✗ Branch 3 not taken.
395 $$= NEW_PTN PTI_temporal_literal(@$, $2, MYSQL_TYPE_TIME, YYCSCL);
14926 }
14927 | TIMESTAMP_SYM TEXT_STRING
14928 {
14929
2/4
✓ Branch 0 taken 792 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 792 times.
✗ Branch 3 not taken.
792 $$= NEW_PTN PTI_temporal_literal(@$, $2, MYSQL_TYPE_DATETIME, YYCSCL);
14930 }
14931 ;
14932
14933 opt_interval:
14934 26 /* empty */ { $$ = false; }
14935 2 | INTERVAL_SYM { $$ = true; }
14936 ;
14937
14938
14939 /**********************************************************************
14940 ** Creating different items.
14941 **********************************************************************/
14942
14943 insert_ident:
14944 simple_ident_nospvar
14945 | table_wild
14946 ;
14947
14948 table_wild:
14949 ident '.' '*'
14950 {
14951
2/4
✓ Branch 0 taken 4367 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4367 times.
✗ Branch 3 not taken.
4367 $$ = NEW_PTN Item_asterisk(@$, nullptr, $1.str);
14952 }
14953 | ident '.' ident '.' '*'
14954 {
14955
2/4
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 15 times.
15 if (check_and_convert_db_name(&$1, false) != Ident_name_check::OK)
14956 MYSQL_YYABORT;
14957
2/4
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 15 times.
15 auto schema_name = YYCLIENT_NO_SCHEMA ? nullptr : $1.str;
14958
2/4
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
15 $$ = NEW_PTN Item_asterisk(@$, schema_name, $3.str);
14959 }
14960 ;
14961
14962 order_expr:
14963 expr opt_ordering_direction
14964 {
14965
2/4
✓ Branch 0 taken 1019276 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1019276 times.
✗ Branch 3 not taken.
1019276 $$= NEW_PTN PT_order_expr($1, $2);
14966 }
14967 ;
14968
14969 grouping_expr:
14970 expr
14971 {
14972
2/4
✓ Branch 0 taken 175379 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 175379 times.
✗ Branch 3 not taken.
175379 $$= NEW_PTN PT_order_expr($1, ORDER_NOT_RELEVANT);
14973 }
14974 ;
14975
14976 simple_ident:
14977 ident
14978 {
14979
2/4
✓ Branch 0 taken 9181225 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9181245 times.
✗ Branch 3 not taken.
9181230 $$= NEW_PTN PTI_simple_ident_ident(@$, to_lex_cstring($1));
14980 }
14981 | simple_ident_q
14982 ;
14983
14984 simple_ident_nospvar:
14985 ident
14986 {
14987
2/4
✓ Branch 0 taken 18597256 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18597292 times.
✗ Branch 3 not taken.
18597271 $$= NEW_PTN PTI_simple_ident_nospvar_ident(@$, $1);
14988 }
14989 | simple_ident_q
14990 ;
14991
14992 simple_ident_q:
14993 ident '.' ident
14994 {
14995
2/4
✓ Branch 0 taken 28643980 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28643979 times.
✗ Branch 3 not taken.
28643978 $$= NEW_PTN PTI_simple_ident_q_2d(@$, $1.str, $3.str);
14996 }
14997 | ident '.' ident '.' ident
14998 {
14999
2/4
✓ Branch 0 taken 1651600 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1651600 times.
1651600 if (check_and_convert_db_name(&$1, false) != Ident_name_check::OK)
15000 MYSQL_YYABORT;
15001
2/4
✓ Branch 0 taken 1651600 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1651600 times.
✗ Branch 3 not taken.
1651600 $$= NEW_PTN PTI_simple_ident_q_3d(@$, $1.str, $3.str, $5.str);
15002 }
15003 ;
15004
15005 table_ident:
15006 ident
15007 {
15008
1/2
✓ Branch 0 taken 4843189 times.
✗ Branch 1 not taken.
4842831 $$= NEW_PTN Table_ident(to_lex_cstring($1));
15009
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4842954 times.
4842954 if ($$ == NULL)
15010 MYSQL_YYABORT;
15011 }
15012 | ident '.' ident
15013 {
15014
1/2
✓ Branch 0 taken 6872503 times.
✗ Branch 1 not taken.
6872490 auto schema_name = YYCLIENT_NO_SCHEMA ? LEX_CSTRING{}
15015
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6872503 times.
6872503 : to_lex_cstring($1.str);
15016
1/2
✓ Branch 0 taken 6872506 times.
✗ Branch 1 not taken.
6872503 $$= NEW_PTN Table_ident(schema_name, to_lex_cstring($3));
15017
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6872493 times.
6872493 if ($$ == NULL)
15018 MYSQL_YYABORT;
15019 }
15020 ;
15021
15022 table_ident_opt_wild:
15023 ident opt_wild
15024 {
15025
1/2
✓ Branch 0 taken 1700 times.
✗ Branch 1 not taken.
1700 $$= NEW_PTN Table_ident(to_lex_cstring($1));
15026
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1700 times.
1700 if ($$ == NULL)
15027 MYSQL_YYABORT;
15028 }
15029 | ident '.' ident opt_wild
15030 {
15031 284 $$= NEW_PTN Table_ident(YYTHD->get_protocol(),
15032 284 to_lex_cstring($1),
15033
2/4
✓ Branch 0 taken 284 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 284 times.
✗ Branch 3 not taken.
284 to_lex_cstring($3), 0);
15034
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 284 times.
284 if ($$ == NULL)
15035 MYSQL_YYABORT;
15036 }
15037 ;
15038
15039 IDENT_sys:
15040 797152 IDENT { $$= $1; }
15041 | IDENT_QUOTED
15042 {
15043 129907115 THD *thd= YYTHD;
15044
15045
2/2
✓ Branch 0 taken 76268500 times.
✓ Branch 1 taken 53638615 times.
129907115 if (thd->charset_is_system_charset)
15046 {
15047 76268500 const CHARSET_INFO *cs= system_charset_info;
15048 int dummy_error;
15049 152537008 size_t wlen= cs->cset->well_formed_len(cs, $1.str,
15050
1/2
✓ Branch 0 taken 76268508 times.
✗ Branch 1 not taken.
76268500 $1.str+$1.length,
15051 $1.length, &dummy_error);
15052
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 76268492 times.
76268508 if (wlen < $1.length)
15053 {
15054
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 ErrConvString err($1.str, $1.length, &my_charset_bin);
15055 16 my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
15056
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 cs->csname, err.ptr());
15057 16 MYSQL_YYABORT;
15058 }
15059 76268492 $$= $1;
15060 }
15061 else
15062 {
15063
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 53639688 times.
107278303 if (thd->convert_string(&$$, system_charset_info,
15064
1/2
✓ Branch 0 taken 53639688 times.
✗ Branch 1 not taken.
53638682 $1.str, $1.length, thd->charset()))
15065 MYSQL_YYABORT;
15066 }
15067 }
15068 ;
15069
15070 TEXT_STRING_sys_nonewline:
15071 TEXT_STRING_sys
15072 {
15073
3/4
✓ Branch 0 taken 33863 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 33859 times.
✓ Branch 3 taken 4 times.
33863 if (!strcont($1.str, "\n"))
15074 33859 $$= $1;
15075 else
15076 {
15077
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 my_error(ER_WRONG_VALUE, MYF(0), "argument contains not-allowed LF", $1.str);
15078 4 MYSQL_YYABORT;
15079 }
15080 }
15081 ;
15082
15083 filter_wild_db_table_string:
15084 TEXT_STRING_sys_nonewline
15085 {
15086
3/4
✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29 times.
✓ Branch 3 taken 5 times.
34 if (strcont($1.str, "."))
15087 29 $$= $1;
15088 else
15089 {
15090
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 my_error(ER_INVALID_RPL_WILD_TABLE_FILTER_PATTERN, MYF(0));
15091 5 MYSQL_YYABORT;
15092 }
15093 }
15094 ;
15095
15096 TEXT_STRING_sys:
15097 TEXT_STRING
15098 {
15099 455791 THD *thd= YYTHD;
15100
15101
2/2
✓ Branch 0 taken 13813 times.
✓ Branch 1 taken 441978 times.
455791 if (thd->charset_is_system_charset)
15102 13813 $$= $1;
15103 else
15104 {
15105
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 441978 times.
883956 if (thd->convert_string(&$$, system_charset_info,
15106
1/2
✓ Branch 0 taken 441978 times.
✗ Branch 1 not taken.
441978 $1.str, $1.length, thd->charset()))
15107 MYSQL_YYABORT;
15108 }
15109 }
15110 ;
15111
15112 TEXT_STRING_literal:
15113 TEXT_STRING
15114 {
15115 3722432 THD *thd= YYTHD;
15116
15117
2/2
✓ Branch 0 taken 3721869 times.
✓ Branch 1 taken 563 times.
3722432 if (thd->charset_is_collation_connection)
15118 3721869 $$= $1;
15119 else
15120 {
15121
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 563 times.
1126 if (thd->convert_string(&$$, thd->variables.collation_connection,
15122
1/2
✓ Branch 0 taken 563 times.
✗ Branch 1 not taken.
563 $1.str, $1.length, thd->charset()))
15123 MYSQL_YYABORT;
15124 }
15125 }
15126 ;
15127
15128 TEXT_STRING_filesystem:
15129 TEXT_STRING
15130 {
15131 56510 THD *thd= YYTHD;
15132
15133
2/2
✓ Branch 0 taken 56507 times.
✓ Branch 1 taken 3 times.
56510 if (thd->charset_is_character_set_filesystem)
15134 56507 $$= $1;
15135 else
15136 {
15137
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
6 if (thd->convert_string(&$$,
15138 thd->variables.character_set_filesystem,
15139
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 $1.str, $1.length, thd->charset()))
15140 MYSQL_YYABORT;
15141 }
15142 }
15143 ;
15144
15145 TEXT_STRING_password:
15146 TEXT_STRING
15147 ;
15148
15149 TEXT_STRING_hash:
15150 TEXT_STRING_sys
15151 | HEX_NUM
15152 {
15153
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 $$= to_lex_string(Item_hex_string::make_hex_str($1.str, $1.length));
15154 }
15155 ;
15156
15157 TEXT_STRING_validated:
15158 TEXT_STRING
15159 {
15160 111329 THD *thd= YYTHD;
15161
15162
2/2
✓ Branch 0 taken 4434 times.
✓ Branch 1 taken 106895 times.
111329 if (thd->charset_is_system_charset)
15163 4434 $$= $1;
15164 else
15165 {
15166
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 106893 times.
213790 if (thd->convert_string(&$$, system_charset_info,
15167
1/2
✓ Branch 0 taken 106895 times.
✗ Branch 1 not taken.
106895 $1.str, $1.length, thd->charset(), true))
15168 2 MYSQL_YYABORT;
15169 }
15170 }
15171 ;
15172
15173 ident:
15174 122615363 IDENT_sys { $$=$1; }
15175 | ident_keyword
15176 {
15177 11658361 THD *thd= YYTHD;
15178
1/2
✓ Branch 0 taken 11658361 times.
✗ Branch 1 not taken.
11658361 $$.str= thd->strmake($1.str, $1.length);
15179
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11658361 times.
11658361 if ($$.str == NULL)
15180 MYSQL_YYABORT;
15181 11658361 $$.length= $1.length;
15182 }
15183 ;
15184
15185 role_ident:
15186 IDENT_sys
15187 | role_keyword
15188 {
15189
1/2
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
12 $$.str= YYTHD->strmake($1.str, $1.length);
15190
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
12 if ($$.str == NULL)
15191 MYSQL_YYABORT;
15192 12 $$.length= $1.length;
15193 }
15194 ;
15195
15196 label_ident:
15197 9303 IDENT_sys { $$=to_lex_cstring($1); }
15198 | label_keyword
15199 {
15200 62 THD *thd= YYTHD;
15201
1/2
✓ Branch 0 taken 62 times.
✗ Branch 1 not taken.
62 $$.str= thd->strmake($1.str, $1.length);
15202
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 62 times.
62 if ($$.str == NULL)
15203 MYSQL_YYABORT;
15204 62 $$.length= $1.length;
15205 }
15206 ;
15207
15208 lvalue_ident:
15209 IDENT_sys
15210 | lvalue_keyword
15211 {
15212
1/2
✓ Branch 0 taken 54479 times.
✗ Branch 1 not taken.
54467 $$.str= YYTHD->strmake($1.str, $1.length);
15213
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 54479 times.
54479 if ($$.str == NULL)
15214 MYSQL_YYABORT;
15215 54479 $$.length= $1.length;
15216 }
15217 ;
15218
15219 ident_or_text:
15220 3451782 ident { $$=$1;}
15221 164493 | TEXT_STRING_sys { $$=$1;}
15222 1687013 | LEX_HOSTNAME { $$=$1;}
15223 ;
15224
15225 role_ident_or_text:
15226 role_ident
15227 | TEXT_STRING_sys
15228 | LEX_HOSTNAME
15229 ;
15230
15231 user_ident_or_text:
15232 ident_or_text
15233 {
15234
3/4
✓ Branch 0 taken 11691 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 11690 times.
11691 if (!($$= LEX_USER::alloc(YYTHD, &$1, NULL)))
15235 1 MYSQL_YYABORT;
15236 }
15237 | ident_or_text '@' ident_or_text
15238 {
15239
3/4
✓ Branch 0 taken 348308 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 70 times.
✓ Branch 3 taken 348238 times.
348309 if (!($$= LEX_USER::alloc(YYTHD, &$1, &$3)))
15240 70 MYSQL_YYABORT;
15241 }
15242 ;
15243
15244 user:
15245 user_ident_or_text
15246 {
15247 359885 $$=$1;
15248 }
15249 | CURRENT_USER optional_braces
15250 {
15251
2/4
✓ Branch 0 taken 151 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 151 times.
151 if (!($$= LEX_USER::alloc(YYTHD)))
15252 MYSQL_YYABORT;
15253 /*
15254 empty LEX_USER means current_user and
15255 will be handled in the get_current_user() function
15256 later
15257 */
15258 }
15259 ;
15260
15261 role:
15262 role_ident_or_text
15263 {
15264
3/4
✓ Branch 0 taken 2330 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 2329 times.
2330 if (!($$= LEX_USER::alloc(YYTHD, &$1, NULL)))
15265 1 MYSQL_YYABORT;
15266 }
15267 | role_ident_or_text '@' ident_or_text
15268 {
15269
2/4
✓ Branch 0 taken 905 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 905 times.
905 if (!($$= LEX_USER::alloc(YYTHD, &$1, &$3)))
15270 MYSQL_YYABORT;
15271 }
15272 ;
15273
15274 schema:
15275 ident
15276 {
15277 4446 $$ = $1;
15278
2/4
✓ Branch 0 taken 4446 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4446 times.
4446 if (check_and_convert_db_name(&$$, false) != Ident_name_check::OK)
15279 MYSQL_YYABORT;
15280 }
15281 ;
15282
15283 /*
15284 Non-reserved keywords are allowed as unquoted identifiers in general.
15285
15286 OTOH, in a few particular cases statement-specific rules are used
15287 instead of `ident_keyword` to avoid grammar ambiguities:
15288
15289 * `label_keyword` for SP label names
15290 * `role_keyword` for role names
15291 * `lvalue_keyword` for variable prefixes and names in left sides of
15292 assignments in SET statements
15293
15294 Normally, new non-reserved words should be added to the
15295 the rule `ident_keywords_unambiguous`. If they cause grammar conflicts, try
15296 one of `ident_keywords_ambiguous_...` rules instead.
15297 */
15298 ident_keyword:
15299 ident_keywords_unambiguous
15300 | ident_keywords_ambiguous_1_roles_and_labels
15301 | ident_keywords_ambiguous_2_labels
15302 | ident_keywords_ambiguous_3_roles
15303 | ident_keywords_ambiguous_4_system_variables
15304 ;
15305
15306 /*
15307 These non-reserved words cannot be used as role names and SP label names:
15308 */
15309 ident_keywords_ambiguous_1_roles_and_labels:
15310 EXECUTE_SYM
15311 | RESTART_SYM
15312 | SHUTDOWN
15313 ;
15314
15315 /*
15316 These non-reserved keywords cannot be used as unquoted SP label names:
15317 */
15318 ident_keywords_ambiguous_2_labels:
15319 ASCII_SYM
15320 | BEGIN_SYM
15321 | BYTE_SYM
15322 | CACHE_SYM
15323 | CHARSET
15324 | CHECKSUM_SYM
15325 | CLONE_SYM
15326 | COMMENT_SYM
15327 | COMMIT_SYM
15328 | COMPRESSION_DICTIONARY_SYM
15329 | CONTAINS_SYM
15330 | DEALLOCATE_SYM
15331 | DO_SYM
15332 | END
15333 | FLUSH_SYM
15334 | FOLLOWS_SYM
15335 | HANDLER_SYM
15336 | HELP_SYM
15337 | IMPORT
15338 | INSTALL_SYM
15339 | LANGUAGE_SYM
15340 | NO_SYM
15341 | PRECEDES_SYM
15342 | PREPARE_SYM
15343 | REPAIR
15344 | RESET_SYM
15345 | ROLLBACK_SYM
15346 | SAVEPOINT_SYM
15347 | SIGNED_SYM
15348 | SLAVE
15349 | START_SYM
15350 | STOP_SYM
15351 | TRUNCATE_SYM
15352 | UNICODE_SYM
15353 | UNINSTALL_SYM
15354 | XA_SYM
15355 ;
15356
15357 /*
15358 Keywords that we allow for labels in SPs in the unquoted form.
15359 Any keyword that is allowed to begin a statement or routine characteristics
15360 must be in `ident_keywords_ambiguous_2_labels` above, otherwise
15361 we get (harmful) shift/reduce conflicts.
15362
15363 Not allowed:
15364
15365 ident_keywords_ambiguous_1_roles_and_labels
15366 ident_keywords_ambiguous_2_labels
15367 */
15368 label_keyword:
15369 ident_keywords_unambiguous
15370 | ident_keywords_ambiguous_3_roles
15371 | ident_keywords_ambiguous_4_system_variables
15372 ;
15373
15374 /*
15375 These non-reserved keywords cannot be used as unquoted role names:
15376 */
15377 ident_keywords_ambiguous_3_roles:
15378 EVENT_SYM
15379 | FILE_SYM
15380 | NONE_SYM
15381 | PROCESS
15382 | PROXY_SYM
15383 | RELOAD
15384 | REPLICATION
15385 | RESOURCE_SYM
15386 | SUPER_SYM
15387 ;
15388
15389 /*
15390 These are the non-reserved keywords which may be used for unquoted
15391 identifiers everywhere without introducing grammar conflicts:
15392 */
15393 ident_keywords_unambiguous:
15394 ACTION
15395 | ACCOUNT_SYM
15396 | ACTIVE_SYM
15397 | ADDDATE_SYM
15398 | ADMIN_SYM
15399 | AFTER_SYM
15400 | AGAINST
15401 | AGGREGATE_SYM
15402 | ALGORITHM_SYM
15403 | ALWAYS_SYM
15404 | ANY_SYM
15405 | ARRAY_SYM
15406 | AT_SYM
15407 | ATTRIBUTE_SYM
15408 | AUTHENTICATION_SYM
15409 | AUTOEXTEND_SIZE_SYM
15410 | AUTO_INC
15411 | AVG_ROW_LENGTH
15412 | AVG_SYM
15413 | BACKUP_SYM
15414 | BINLOG_SYM
15415 | BIT_SYM %prec KEYWORD_USED_AS_IDENT
15416 | BLOCK_SYM
15417 | BOOLEAN_SYM
15418 | BOOL_SYM
15419 | BTREE_SYM
15420 | BUCKETS_SYM
15421 | CASCADED
15422 | CATALOG_NAME_SYM
15423 | CHAIN_SYM
15424 | CHALLENGE_RESPONSE_SYM
15425 | CHANGED
15426 | CHANNEL_SYM
15427 | CIPHER_SYM
15428 | CLASS_ORIGIN_SYM
15429 | CLIENT_SYM
15430 | CLIENT_STATS_SYM
15431 | CLOSE_SYM
15432 | COALESCE
15433 | CODE_SYM
15434 | COLLATION_SYM
15435 | COLUMNS
15436 | COLUMN_FORMAT_SYM
15437 | COLUMN_NAME_SYM
15438 | COMMITTED_SYM
15439 | COMPACT_SYM
15440 | COMPLETION_SYM
15441 | COMPONENT_SYM
15442 | COMPRESSED_SYM
15443 | COMPRESSION_SYM
15444 | CONCURRENT
15445 | CONNECTION_SYM
15446 | CONSISTENT_SYM
15447 | CONSTRAINT_CATALOG_SYM
15448 | CONSTRAINT_NAME_SYM
15449 | CONSTRAINT_SCHEMA_SYM
15450 | CONTEXT_SYM
15451 | CPU_SYM
15452 | CURRENT_SYM /* not reserved in MySQL per WL#2111 specification */
15453 | CURSOR_NAME_SYM
15454 | DATAFILE_SYM
15455 | DATA_SYM
15456 | DATETIME_SYM
15457 | DATE_SYM %prec KEYWORD_USED_AS_IDENT
15458 | DAY_SYM
15459 | DEFAULT_AUTH_SYM
15460 | DEFINER_SYM
15461 | DEFINITION_SYM
15462 | DELAY_KEY_WRITE_SYM
15463 | DESCRIPTION_SYM
15464 | DIAGNOSTICS_SYM
15465 | DIRECTORY_SYM
15466 | DISABLE_SYM
15467 | DISCARD_SYM
15468 | DISK_SYM
15469 | DUMPFILE
15470 | DUPLICATE_SYM
15471 | DYNAMIC_SYM
15472 | EFFECTIVE_SYM
15473 | ENABLE_SYM
15474 | ENCRYPTION_KEY_ID_SYM
15475 | ENCRYPTION_SYM
15476 | ENDS_SYM
15477 | ENFORCED_SYM
15478 | ENGINES_SYM
15479 | ENGINE_SYM
15480 | ENGINE_ATTRIBUTE_SYM
15481 | ENUM_SYM
15482 | ERRORS
15483 | ERROR_SYM
15484 | ESCAPE_SYM
15485 | EVENTS_SYM
15486 | EVERY_SYM
15487 | EXCHANGE_SYM
15488 | EXCLUDE_SYM
15489 | EXPANSION_SYM
15490 | EXPIRE_SYM
15491 | EXPORT_SYM
15492 | EXTENDED_SYM
15493 | EXTENT_SIZE_SYM
15494 | FACTOR_SYM
15495 | FAILED_LOGIN_ATTEMPTS_SYM
15496 | FAST_SYM
15497 | FAULTS_SYM
15498 | FILE_BLOCK_SIZE_SYM
15499 | FILTER_SYM
15500 | FINISH_SYM
15501 | FIRST_SYM
15502 | FIXED_SYM
15503 | FOLLOWING_SYM
15504 | FORMAT_SYM
15505 | FOUND_SYM
15506 | FULL
15507 | GENERAL
15508 | GEOMETRYCOLLECTION_SYM
15509 | GEOMETRY_SYM
15510 | GET_FORMAT
15511 | GET_MASTER_PUBLIC_KEY_SYM
15512 | GET_SOURCE_PUBLIC_KEY_SYM
15513 | GRANTS
15514 | GROUP_REPLICATION
15515 | GTID_ONLY_SYM
15516 | HASH_SYM
15517 | HISTOGRAM_SYM
15518 | HISTORY_SYM
15519 | HOSTS_SYM
15520 | HOST_SYM
15521 | HOUR_SYM
15522 | IDENTIFIED_SYM
15523 | IGNORE_SERVER_IDS_SYM
15524 | INACTIVE_SYM
15525 | INDEX_STATS_SYM
15526 | INDEXES
15527 | INITIAL_SIZE_SYM
15528 | INITIAL_SYM
15529 | INITIATE_SYM
15530 | INSERT_METHOD
15531 | INSTANCE_SYM
15532 | INVISIBLE_SYM
15533 | INVOKER_SYM
15534 | IO_SYM
15535 | IPC_SYM
15536 | ISOLATION
15537 | ISSUER_SYM
15538 | JSON_SYM
15539 | JSON_VALUE_SYM
15540 | KEY_BLOCK_SIZE
15541 | KEYRING_SYM
15542 | LAST_SYM
15543 | LEAVES
15544 | LESS_SYM
15545 | LEVEL_SYM
15546 | LINESTRING_SYM
15547 | LIST_SYM
15548 | LOCKED_SYM
15549 | LOCKS_SYM
15550 | LOGFILE_SYM
15551 | LOGS_SYM
15552 | MASTER_AUTO_POSITION_SYM
15553 | MASTER_COMPRESSION_ALGORITHM_SYM
15554 | MASTER_CONNECT_RETRY_SYM
15555 | MASTER_DELAY_SYM
15556 | MASTER_HEARTBEAT_PERIOD_SYM
15557 | MASTER_HOST_SYM
15558 | NETWORK_NAMESPACE_SYM
15559 | MASTER_LOG_FILE_SYM
15560 | MASTER_LOG_POS_SYM
15561 | MASTER_PASSWORD_SYM
15562 | MASTER_PORT_SYM
15563 | MASTER_PUBLIC_KEY_PATH_SYM
15564 | MASTER_RETRY_COUNT_SYM
15565 | MASTER_SSL_CAPATH_SYM
15566 | MASTER_SSL_CA_SYM
15567 | MASTER_SSL_CERT_SYM
15568 | MASTER_SSL_CIPHER_SYM
15569 | MASTER_SSL_CRLPATH_SYM
15570 | MASTER_SSL_CRL_SYM
15571 | MASTER_SSL_KEY_SYM
15572 | MASTER_SSL_SYM
15573 | MASTER_SYM
15574 | MASTER_TLS_CIPHERSUITES_SYM
15575 | MASTER_TLS_VERSION_SYM
15576 | MASTER_USER_SYM
15577 | MASTER_ZSTD_COMPRESSION_LEVEL_SYM
15578 | MAX_CONNECTIONS_PER_HOUR
15579 | MAX_QUERIES_PER_HOUR
15580 | MAX_ROWS
15581 | MAX_SIZE_SYM
15582 | MAX_UPDATES_PER_HOUR
15583 | MAX_USER_CONNECTIONS_SYM
15584 | MEDIUM_SYM
15585 | MEMBER_SYM
15586 | MEMORY_SYM
15587 | MERGE_SYM
15588 | MESSAGE_TEXT_SYM
15589 | MICROSECOND_SYM
15590 | MIGRATE_SYM
15591 | MINUTE_SYM
15592 | MIN_ROWS
15593 | MODE_SYM
15594 | MODIFY_SYM
15595 | MONTH_SYM
15596 | MULTILINESTRING_SYM
15597 | MULTIPOINT_SYM
15598 | MULTIPOLYGON_SYM
15599 | MUTEX_SYM
15600 | MYSQL_ERRNO_SYM
15601 | NAMES_SYM %prec KEYWORD_USED_AS_IDENT
15602 | NAME_SYM
15603 | NATIONAL_SYM
15604 | NCHAR_SYM
15605 | NDBCLUSTER_SYM
15606 | NESTED_SYM
15607 | NEVER_SYM
15608 | NEW_SYM
15609 | NEXT_SYM
15610 | NODEGROUP_SYM
15611 | NOWAIT_SYM
15612 | NO_WAIT_SYM
15613 | NULLS_SYM
15614 | NUMBER_SYM
15615 | NVARCHAR_SYM
15616 | OFF_SYM
15617 | OFFSET_SYM
15618 | OJ_SYM
15619 | OLD_SYM
15620 | ONE_SYM
15621 | ONLY_SYM
15622 | OPEN_SYM
15623 | OPTIONAL_SYM
15624 | OPTIONS_SYM
15625 | ORDINALITY_SYM
15626 | ORGANIZATION_SYM
15627 | OTHERS_SYM
15628 | OWNER_SYM
15629 | PACK_KEYS_SYM
15630 | PAGE_SYM
15631 | PARSER_SYM
15632 | PARTIAL
15633 | PARTITIONING_SYM
15634 | PARTITIONS_SYM
15635 | PASSWORD %prec KEYWORD_USED_AS_IDENT
15636 | PASSWORD_LOCK_TIME_SYM
15637 | PATH_SYM
15638 | PHASE_SYM
15639 | PLUGINS_SYM
15640 | PLUGIN_DIR_SYM
15641 | PLUGIN_SYM
15642 | POINT_SYM
15643 | POLYGON_SYM
15644 | PORT_SYM
15645 | PRECEDING_SYM
15646 | PRESERVE_SYM
15647 | PREV_SYM
15648 | PRIVILEGES
15649 | PRIVILEGE_CHECKS_USER_SYM
15650 | PROCESSLIST_SYM
15651 | PROFILES_SYM
15652 | PROFILE_SYM
15653 | QUARTER_SYM
15654 | QUERY_SYM
15655 | QUICK
15656 | RANDOM_SYM
15657 | READ_ONLY_SYM
15658 | REBUILD_SYM
15659 | RECOVER_SYM
15660 | REDO_BUFFER_SIZE_SYM
15661 | REDUNDANT_SYM
15662 | REFERENCE_SYM
15663 | REGISTRATION_SYM
15664 | RELAY
15665 | RELAYLOG_SYM
15666 | RELAY_LOG_FILE_SYM
15667 | RELAY_LOG_POS_SYM
15668 | RELAY_THREAD
15669 | REMOVE_SYM
15670 | ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_SYM
15671 | REORGANIZE_SYM
15672 | REPEATABLE_SYM
15673 | REPLICAS_SYM
15674 | REPLICATE_DO_DB
15675 | REPLICATE_DO_TABLE
15676 | REPLICATE_IGNORE_DB
15677 | REPLICATE_IGNORE_TABLE
15678 | REPLICATE_REWRITE_DB
15679 | REPLICATE_WILD_DO_TABLE
15680 | REPLICATE_WILD_IGNORE_TABLE
15681 | REPLICA_SYM
15682 | REQUIRE_ROW_FORMAT_SYM
15683 | REQUIRE_TABLE_PRIMARY_KEY_CHECK_SYM
15684 | RESOURCES
15685 | RESPECT_SYM
15686 | RESTORE_SYM
15687 | RESUME_SYM
15688 | RETAIN_SYM
15689 | RETURNED_SQLSTATE_SYM
15690 | RETURNING_SYM
15691 | RETURNS_SYM
15692 | REUSE_SYM
15693 | REVERSE_SYM
15694 | ROLE_SYM
15695 | ROLLUP_SYM
15696 | ROTATE_SYM
15697 | ROUTINE_SYM
15698 | ROW_COUNT_SYM
15699 | ROW_FORMAT_SYM
15700 | RTREE_SYM
15701 | SCHEDULE_SYM
15702 | SCHEMA_NAME_SYM
15703 | SECONDARY_ENGINE_SYM
15704 | SECONDARY_ENGINE_ATTRIBUTE_SYM
15705 | SECONDARY_LOAD_SYM
15706 | SECONDARY_SYM
15707 | SECONDARY_UNLOAD_SYM
15708 | SECOND_SYM
15709 | SECURITY_SYM
15710 | SERIALIZABLE_SYM
15711 | SERIAL_SYM
15712 | SERVER_SYM
15713 | SHARE_SYM
15714 | SIMPLE_SYM
15715 | SKIP_SYM
15716 | SLOW
15717 | SNAPSHOT_SYM
15718 | SOCKET_SYM
15719 | SONAME_SYM
15720 | SOUNDS_SYM
15721 | SOURCE_AUTO_POSITION_SYM
15722 | SOURCE_BIND_SYM
15723 | SOURCE_COMPRESSION_ALGORITHM_SYM
15724 | SOURCE_CONNECTION_AUTO_FAILOVER_SYM
15725 | SOURCE_CONNECT_RETRY_SYM
15726 | SOURCE_DELAY_SYM
15727 | SOURCE_HEARTBEAT_PERIOD_SYM
15728 | SOURCE_HOST_SYM
15729 | SOURCE_LOG_FILE_SYM
15730 | SOURCE_LOG_POS_SYM
15731 | SOURCE_PASSWORD_SYM
15732 | SOURCE_PORT_SYM
15733 | SOURCE_PUBLIC_KEY_PATH_SYM
15734 | SOURCE_RETRY_COUNT_SYM
15735 | SOURCE_SSL_CAPATH_SYM
15736 | SOURCE_SSL_CA_SYM
15737 | SOURCE_SSL_CERT_SYM
15738 | SOURCE_SSL_CIPHER_SYM
15739 | SOURCE_SSL_CRLPATH_SYM
15740 | SOURCE_SSL_CRL_SYM
15741 | SOURCE_SSL_KEY_SYM
15742 | SOURCE_SSL_SYM
15743 | SOURCE_SSL_VERIFY_SERVER_CERT_SYM
15744 | SOURCE_SYM
15745 | SOURCE_TLS_CIPHERSUITES_SYM
15746 | SOURCE_TLS_VERSION_SYM
15747 | SOURCE_USER_SYM
15748 | SOURCE_ZSTD_COMPRESSION_LEVEL_SYM
15749 | SQL_AFTER_GTIDS
15750 | SQL_AFTER_MTS_GAPS
15751 | SQL_BEFORE_GTIDS
15752 | SQL_BUFFER_RESULT
15753 | SQL_NO_CACHE_SYM
15754 | SQL_THREAD
15755 | SRID_SYM
15756 | STACKED_SYM
15757 | STARTS_SYM
15758 | STATS_AUTO_RECALC_SYM
15759 | STATS_PERSISTENT_SYM
15760 | STATS_SAMPLE_PAGES_SYM
15761 | STATUS_SYM
15762 | STORAGE_SYM
15763 | STREAM_SYM
15764 | STRING_SYM
15765 | ST_COLLECT_SYM
15766 | SUBCLASS_ORIGIN_SYM
15767 | SUBDATE_SYM
15768 | SUBJECT_SYM
15769 | SUBPARTITIONS_SYM
15770 | SUBPARTITION_SYM
15771 | SUSPEND_SYM
15772 | SWAPS_SYM
15773 | SWITCHES_SYM
15774 | TABLES
15775 | TABLESPACE_SYM
15776 | TABLE_CHECKSUM_SYM
15777 | TABLE_NAME_SYM
15778 | TABLE_STATS_SYM
15779 | TEMPORARY
15780 | TEMPTABLE_SYM
15781 | TEXT_SYM
15782 | THAN_SYM
15783 | THREAD_PRIORITY_SYM
15784 | THREAD_STATS_SYM
15785 | TIES_SYM
15786 | TIMESTAMP_ADD
15787 | TIMESTAMP_DIFF
15788 | TIMESTAMP_SYM %prec KEYWORD_USED_AS_IDENT
15789 | TIME_SYM %prec KEYWORD_USED_AS_IDENT
15790 | TLS_SYM
15791 | TRANSACTION_SYM
15792 | TRIGGERS_SYM
15793 | TYPES_SYM
15794 | TYPE_SYM
15795 | UNBOUNDED_SYM
15796 | UNCOMMITTED_SYM
15797 | UNDEFINED_SYM
15798 | UNDOFILE_SYM
15799 | UNDO_BUFFER_SIZE_SYM
15800 | UNKNOWN_SYM
15801 | UNREGISTER_SYM
15802 | UNTIL_SYM
15803 | UPGRADE_SYM
15804 | USER
15805 | USER_STATS_SYM
15806 | USE_FRM
15807 | VALIDATION_SYM
15808 | VALUE_SYM
15809 | VARIABLES
15810 | VCPU_SYM
15811 | VIEW_SYM
15812 | VISIBLE_SYM
15813 | WAIT_SYM
15814 | WARNINGS
15815 | WEEK_SYM
15816 | WEIGHT_STRING_SYM
15817 | WITHOUT_SYM
15818 | WORK_SYM
15819 | WRAPPER_SYM
15820 | X509_SYM
15821 | XID_SYM
15822 | XML_SYM
15823 | YEAR_SYM
15824 | ZONE_SYM
15825 ;
15826
15827 /*
15828 Non-reserved keywords that we allow for unquoted role names:
15829
15830 Not allowed:
15831
15832 ident_keywords_ambiguous_1_roles_and_labels
15833 ident_keywords_ambiguous_3_roles
15834 */
15835 role_keyword:
15836 ident_keywords_unambiguous
15837 | ident_keywords_ambiguous_2_labels
15838 | ident_keywords_ambiguous_4_system_variables
15839 ;
15840
15841 /*
15842 Non-reserved words allowed for unquoted unprefixed variable names and
15843 unquoted variable prefixes in the left side of assignments in SET statements:
15844
15845 Not allowed:
15846
15847 ident_keywords_ambiguous_4_system_variables
15848 */
15849 lvalue_keyword:
15850 ident_keywords_unambiguous
15851 | ident_keywords_ambiguous_1_roles_and_labels
15852 | ident_keywords_ambiguous_2_labels
15853 | ident_keywords_ambiguous_3_roles
15854 ;
15855
15856 /*
15857 These non-reserved keywords cannot be used as unquoted unprefixed
15858 variable names and unquoted variable prefixes in the left side of
15859 assignments in SET statements:
15860 */
15861 ident_keywords_ambiguous_4_system_variables:
15862 GLOBAL_SYM
15863 | LOCAL_SYM
15864 | PERSIST_SYM
15865 | PERSIST_ONLY_SYM
15866 | SESSION_SYM
15867 ;
15868
15869 /*
15870 SQLCOM_SET_OPTION statement.
15871
15872 Note that to avoid shift/reduce conflicts, we have separate rules for the
15873 first option listed in the statement.
15874 */
15875
15876 set:
15877 SET_SYM start_option_value_list
15878 {
15879
2/4
✓ Branch 0 taken 1428137 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1428198 times.
✗ Branch 3 not taken.
1428159 $$= NEW_PTN PT_set(@1, $2);
15880 }
15881 ;
15882
15883
15884 // Start of option value list
15885 start_option_value_list:
15886 option_value_no_option_type option_value_list_continued
15887 {
15888
2/4
✓ Branch 0 taken 1026632 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1026701 times.
✗ Branch 3 not taken.
1026617 $$= NEW_PTN PT_start_option_value_list_no_type($1, @1, $2);
15889 }
15890 | TRANSACTION_SYM transaction_characteristics
15891 {
15892
2/4
✓ Branch 0 taken 2866 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2866 times.
✗ Branch 3 not taken.
2866 $$= NEW_PTN PT_start_option_value_list_transaction($2, @2);
15893 }
15894 | option_type start_option_value_list_following_option_type
15895 {
15896
2/4
✓ Branch 0 taken 397629 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 397630 times.
✗ Branch 3 not taken.
397629 $$= NEW_PTN PT_start_option_value_list_type($1, $2);
15897 }
15898 | PASSWORD equal TEXT_STRING_password opt_replace_password opt_retain_current_password
15899 {
15900
1/2
✓ Branch 0 taken 223 times.
✗ Branch 1 not taken.
446 $$= NEW_PTN PT_option_value_no_option_type_password($3.str, $4.str,
15901 223 $5,
15902 false,
15903
1/2
✓ Branch 0 taken 223 times.
✗ Branch 1 not taken.
446 @4);
15904 }
15905 | PASSWORD TO_SYM RANDOM_SYM opt_replace_password opt_retain_current_password
15906 {
15907 // RANDOM PASSWORD GENERATION AND RETURN RESULT SET...
15908
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
14 $$= NEW_PTN PT_option_value_no_option_type_password($3.str, $4.str,
15909 7 $5,
15910 true,
15911
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
14 @4);
15912 }
15913 | PASSWORD FOR_SYM user equal TEXT_STRING_password opt_replace_password opt_retain_current_password
15914 {
15915
1/2
✓ Branch 0 taken 649 times.
✗ Branch 1 not taken.
1298 $$= NEW_PTN PT_option_value_no_option_type_password_for($3, $5.str,
15916 649 $6.str,
15917 649 $7,
15918 false,
15919
1/2
✓ Branch 0 taken 649 times.
✗ Branch 1 not taken.
1298 @6);
15920 }
15921 | PASSWORD FOR_SYM user TO_SYM RANDOM_SYM opt_replace_password opt_retain_current_password
15922 {
15923 // RANDOM PASSWORD GENERATION AND RETURN RESULT SET...
15924
1/2
✓ Branch 0 taken 51 times.
✗ Branch 1 not taken.
102 $$= NEW_PTN PT_option_value_no_option_type_password_for($3, $5.str,
15925 51 $6.str,
15926 51 $7,
15927 true,
15928
1/2
✓ Branch 0 taken 51 times.
✗ Branch 1 not taken.
102 @6);
15929 }
15930 ;
15931
15932 set_role_stmt:
15933 SET_SYM ROLE_SYM role_list
15934 {
15935
1/2
✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
189 $$= NEW_PTN PT_set_role($3);
15936 }
15937 | SET_SYM ROLE_SYM NONE_SYM
15938 {
15939
1/2
✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
38 $$= NEW_PTN PT_set_role(role_enum::ROLE_NONE);
15940 38 Lex->sql_command= SQLCOM_SET_ROLE;
15941 }
15942 | SET_SYM ROLE_SYM DEFAULT_SYM
15943 {
15944
1/2
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
21 $$= NEW_PTN PT_set_role(role_enum::ROLE_DEFAULT);
15945 21 Lex->sql_command= SQLCOM_SET_ROLE;
15946 }
15947 | SET_SYM DEFAULT_SYM ROLE_SYM role_list TO_SYM role_list
15948 {
15949
1/2
✓ Branch 0 taken 497 times.
✗ Branch 1 not taken.
994 $$= NEW_PTN PT_alter_user_default_role(false, $6, $4,
15950 994 role_enum::ROLE_NAME);
15951 }
15952 | SET_SYM DEFAULT_SYM ROLE_SYM NONE_SYM TO_SYM role_list
15953 {
15954
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
32 $$= NEW_PTN PT_alter_user_default_role(false, $6, NULL,
15955 32 role_enum::ROLE_NONE);
15956 }
15957 | SET_SYM DEFAULT_SYM ROLE_SYM ALL TO_SYM role_list
15958 {
15959
1/2
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
28 $$= NEW_PTN PT_alter_user_default_role(false, $6, NULL,
15960 28 role_enum::ROLE_ALL);
15961 }
15962 | SET_SYM ROLE_SYM ALL opt_except_role_list
15963 {
15964
1/2
✓ Branch 0 taken 70 times.
✗ Branch 1 not taken.
70 $$= NEW_PTN PT_set_role(role_enum::ROLE_ALL, $4);
15965 70 Lex->sql_command= SQLCOM_SET_ROLE;
15966 }
15967 ;
15968
15969 opt_except_role_list:
15970 87 /* empty */ { $$= NULL; }
15971 30 | EXCEPT_SYM role_list { $$= $2; }
15972 ;
15973
15974 set_resource_group_stmt:
15975 SET_SYM RESOURCE_SYM GROUP_SYM ident
15976 {
15977
1/2
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
18 $$= NEW_PTN PT_set_resource_group(to_lex_cstring($4), nullptr);
15978 }
15979 | SET_SYM RESOURCE_SYM GROUP_SYM ident FOR_SYM thread_id_list_options
15980 {
15981
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 $$= NEW_PTN PT_set_resource_group(to_lex_cstring($4), $6);
15982 }
15983 ;
15984
15985 thread_id_list:
15986 real_ulong_num
15987 {
15988
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 $$= NEW_PTN Mem_root_array<ulonglong>(YYMEM_ROOT);
15989
4/8
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
4 if ($$ == nullptr || $$->push_back($1))
15990 MYSQL_YYABORT; // OOM
15991 }
15992 | thread_id_list opt_comma real_ulong_num
15993 {
15994 1 $$= $1;
15995
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if ($$->push_back($3))
15996 MYSQL_YYABORT; // OOM
15997 }
15998 ;
15999
16000 thread_id_list_options:
16001 4 thread_id_list { $$= $1; }
16002 ;
16003
16004 // Start of option value list, option_type was given
16005 start_option_value_list_following_option_type:
16006 option_value_following_option_type option_value_list_continued
16007 {
16008 384578 $$=
16009
1/2
✓ Branch 0 taken 384577 times.
✗ Branch 1 not taken.
769155 NEW_PTN PT_start_option_value_list_following_option_type_eq($1,
16010 384577 @1,
16011
1/2
✓ Branch 0 taken 384578 times.
✗ Branch 1 not taken.
769154 $2);
16012 }
16013 | TRANSACTION_SYM transaction_characteristics
16014 {
16015
1/2
✓ Branch 0 taken 13051 times.
✗ Branch 1 not taken.
26102 $$= NEW_PTN
16016 PT_start_option_value_list_following_option_type_transaction($2,
16017
1/2
✓ Branch 0 taken 13051 times.
✗ Branch 1 not taken.
26102 @2);
16018 }
16019 ;
16020
16021 // Remainder of the option value list after first option value.
16022 option_value_list_continued:
16023 1370249 /* empty */ { $$= NULL; }
16024 40950 | ',' option_value_list { $$= $2; }
16025 ;
16026
16027 // Repeating list of option values after first option value.
16028 option_value_list:
16029 option_value
16030 {
16031
2/4
✓ Branch 0 taken 40949 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 40949 times.
✗ Branch 3 not taken.
40949 $$= NEW_PTN PT_option_value_list_head(@0, $1, @1);
16032 }
16033 | option_value_list ',' option_value
16034 {
16035
2/4
✓ Branch 0 taken 16089 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16089 times.
✗ Branch 3 not taken.
16090 $$= NEW_PTN PT_option_value_list($1, @2, $3, @3);
16036 }
16037 ;
16038
16039 // Wrapper around option values following the first option value in the stmt.
16040 option_value:
16041 option_type option_value_following_option_type
16042 {
16043
2/4
✓ Branch 0 taken 476 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 476 times.
✗ Branch 3 not taken.
476 $$= NEW_PTN PT_option_value_type($1, $2);
16044 }
16045 56563 | option_value_no_option_type { $$= $1; }
16046 ;
16047
16048 option_type:
16049 199430 GLOBAL_SYM { $$=OPT_GLOBAL; }
16050 3310 | PERSIST_SYM { $$=OPT_PERSIST; }
16051 1613 | PERSIST_ONLY_SYM { $$=OPT_PERSIST_ONLY; }
16052 435 | LOCAL_SYM { $$=OPT_SESSION; }
16053 193330 | SESSION_SYM { $$=OPT_SESSION; }
16054 ;
16055
16056 opt_var_type:
16057 94979 /* empty */ { $$=OPT_SESSION; }
16058 33395 | GLOBAL_SYM { $$=OPT_GLOBAL; }
16059 22 | LOCAL_SYM { $$=OPT_SESSION; }
16060 41139 | SESSION_SYM { $$=OPT_SESSION; }
16061 ;
16062
16063 opt_rvalue_system_variable_type:
16064 280540 /* empty */ { $$=OPT_DEFAULT; }
16065 257899 | GLOBAL_SYM '.' { $$=OPT_GLOBAL; }
16066 505 | LOCAL_SYM '.' { $$=OPT_SESSION; }
16067 37753 | SESSION_SYM '.' { $$=OPT_SESSION; }
16068 ;
16069
16070 opt_set_var_ident_type:
16071 58017 /* empty */ { $$=OPT_DEFAULT; }
16072 141 | PERSIST_SYM '.' { $$=OPT_PERSIST; }
16073 252 | PERSIST_ONLY_SYM '.' {$$=OPT_PERSIST_ONLY; }
16074 27078 | GLOBAL_SYM '.' { $$=OPT_GLOBAL; }
16075 245 | LOCAL_SYM '.' { $$=OPT_SESSION; }
16076 126657 | SESSION_SYM '.' { $$=OPT_SESSION; }
16077 ;
16078
16079 // Option values with preceding option_type.
16080 option_value_following_option_type:
16081 lvalue_variable equal set_expr_or_default
16082 {
16083 385056 $$ = NEW_PTN PT_set_scoped_system_variable(
16084
2/4
✓ Branch 0 taken 385055 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 385056 times.
✗ Branch 3 not taken.
385054 @1, $1.prefix, $1.name, $3);
16085 }
16086 ;
16087
16088 // Option values without preceding option_type.
16089 option_value_no_option_type:
16090 lvalue_variable equal set_expr_or_default
16091 {
16092
2/4
✓ Branch 0 taken 418097 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 418145 times.
✗ Branch 3 not taken.
418103 $$ = NEW_PTN PT_set_variable(@1, $1.prefix, $1.name, @3, $3);
16093 }
16094 | '@' ident_or_text equal expr
16095 {
16096
2/4
✓ Branch 0 taken 439489 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 439489 times.
✗ Branch 3 not taken.
439489 $$= NEW_PTN PT_option_value_no_option_type_user_var($2, $4);
16097 }
16098 | '@' '@' opt_set_var_ident_type lvalue_variable equal
16099 set_expr_or_default
16100 {
16101
1/2
✓ Branch 0 taken 212376 times.
✗ Branch 1 not taken.
424751 $$ = NEW_PTN PT_set_system_variable(
16102
1/2
✓ Branch 0 taken 212375 times.
✗ Branch 1 not taken.
424770 $3, @4, $4.prefix, $4.name, $6);
16103 }
16104 | character_set old_or_new_charset_name_or_default
16105 {
16106
2/4
✓ Branch 0 taken 43 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 43 times.
✗ Branch 3 not taken.
43 $$= NEW_PTN PT_option_value_no_option_type_charset($2);
16107 }
16108 | NAMES_SYM equal expr
16109 {
16110 /*
16111 Bad syntax, always fails with an error
16112 */
16113
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 $$= NEW_PTN PT_option_value_no_option_type_names(@2);
16114 }
16115 | NAMES_SYM charset_name opt_collate
16116 {
16117
2/4
✓ Branch 0 taken 13152 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13152 times.
✗ Branch 3 not taken.
13151 $$= NEW_PTN PT_set_names($2, $3);
16118 }
16119 | NAMES_SYM DEFAULT_SYM
16120 {
16121
2/4
✓ Branch 0 taken 104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 104 times.
✗ Branch 3 not taken.
104 $$ = NEW_PTN PT_set_names(nullptr, nullptr);
16122 }
16123 ;
16124
16125 lvalue_variable:
16126 lvalue_ident
16127 {
16128 995496 $$ = Bipartite_name{{}, to_lex_cstring($1)};
16129 }
16130 | lvalue_ident '.' ident
16131 {
16132 /*
16133 Reject names prefixed by `GLOBAL.`, `LOCAL.`, or `SESSION.` --
16134 if one of those prefixes is there then we are parsing something
16135 like `GLOBAL.GLOBAL.foo` or `LOCAL.SESSION.bar` etc.
16136 */
16137
3/4
✓ Branch 0 taken 20211 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 113 times.
✓ Branch 3 taken 20098 times.
20211 if (check_reserved_words($1.str)) {
16138
1/2
✓ Branch 0 taken 113 times.
✗ Branch 1 not taken.
113 YYTHD->syntax_error_at(@1);
16139 113 MYSQL_YYABORT;
16140 }
16141 20098 $$ = Bipartite_name{to_lex_cstring($1), to_lex_cstring($3)};
16142 }
16143 | DEFAULT_SYM '.' ident
16144 {
16145 $$ = Bipartite_name{{STRING_WITH_LEN("default")}, to_lex_cstring($3)};
16146 }
16147 ;
16148
16149 rvalue_system_variable:
16150 ident_or_text
16151 {
16152 576406 $$ = Bipartite_name{{}, to_lex_cstring($1)};
16153 }
16154 | ident_or_text '.' ident
16155 {
16156 // disallow "SELECT @@global.global.variable"
16157
3/4
✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 283 times.
286 if (check_reserved_words($1.str)) {
16158
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 YYTHD->syntax_error_at(@1);
16159 3 MYSQL_YYABORT;
16160 }
16161 283 $$ = Bipartite_name{to_lex_cstring($1), to_lex_cstring($3)};
16162 }
16163 ;
16164
16165 transaction_characteristics:
16166 transaction_access_mode opt_isolation_level
16167 {
16168
2/4
✓ Branch 0 taken 12622 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12622 times.
✗ Branch 3 not taken.
12622 $$= NEW_PTN PT_transaction_characteristics($1, $2);
16169 }
16170 | isolation_level opt_transaction_access_mode
16171 {
16172
2/4
✓ Branch 0 taken 3295 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3295 times.
✗ Branch 3 not taken.
3295 $$= NEW_PTN PT_transaction_characteristics($1, $2);
16173 }
16174 ;
16175
16176 transaction_access_mode:
16177 transaction_access_mode_types
16178 {
16179
2/4
✓ Branch 0 taken 12630 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12630 times.
✗ Branch 3 not taken.
12630 $$= NEW_PTN PT_transaction_access_mode($1);
16180 }
16181 ;
16182
16183 opt_transaction_access_mode:
16184 3288 /* empty */ { $$= NULL; }
16185 7 | ',' transaction_access_mode { $$= $2; }
16186 ;
16187
16188 isolation_level:
16189 ISOLATION LEVEL_SYM isolation_types
16190 {
16191
2/4
✓ Branch 0 taken 3302 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3302 times.
✗ Branch 3 not taken.
3302 $$= NEW_PTN PT_isolation_level($3);
16192 }
16193 ;
16194
16195 opt_isolation_level:
16196 12615 /* empty */ { $$= NULL; }
16197 7 | ',' isolation_level { $$= $2; }
16198 ;
16199
16200 transaction_access_mode_types:
16201 45 READ_SYM ONLY_SYM { $$= true; }
16202 12585 | READ_SYM WRITE_SYM { $$= false; }
16203 ;
16204
16205 isolation_types:
16206 129 READ_SYM UNCOMMITTED_SYM { $$= ISO_READ_UNCOMMITTED; }
16207 2788 | READ_SYM COMMITTED_SYM { $$= ISO_READ_COMMITTED; }
16208 181 | REPEATABLE_SYM READ_SYM { $$= ISO_REPEATABLE_READ; }
16209 204 | SERIALIZABLE_SYM { $$= ISO_SERIALIZABLE; }
16210 ;
16211
16212 set_expr_or_default:
16213 expr
16214 70042 | DEFAULT_SYM { $$= NULL; }
16215 | ON_SYM
16216 {
16217
2/4
✓ Branch 0 taken 28487 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28487 times.
✗ Branch 3 not taken.
28487 $$= NEW_PTN Item_string(@$, "ON", 2, system_charset_info);
16218 }
16219 | ALL
16220 {
16221
2/4
✓ Branch 0 taken 97 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 97 times.
✗ Branch 3 not taken.
97 $$= NEW_PTN Item_string(@$, "ALL", 3, system_charset_info);
16222 }
16223 | BINARY_SYM
16224 {
16225
2/4
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48 times.
✗ Branch 3 not taken.
48 $$= NEW_PTN Item_string(@$, "binary", 6, system_charset_info);
16226 }
16227 | ROW_SYM
16228 {
16229
2/4
✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 50 times.
✗ Branch 3 not taken.
50 $$= NEW_PTN Item_string(@$, "ROW", 3, system_charset_info);
16230 }
16231 | SYSTEM_SYM
16232 {
16233
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 $$= NEW_PTN Item_string(@$, "SYSTEM", 6, system_charset_info);
16234 }
16235 | FORCE_SYM
16236 {
16237 $$= NEW_PTN Item_string(@$, "FORCE", 5, system_charset_info);
16238 }
16239 ;
16240
16241 /* Lock function */
16242
16243 lock:
16244 LOCK_SYM lock_variant
16245 {
16246
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3159 times.
3162 if (Lex->sphead)
16247 {
16248
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_SP_BADSTATEMENT, MYF(0), "LOCK");
16249 3 MYSQL_YYABORT;
16250 }
16251 }
16252 ;
16253
16254 lock_variant:
16255 TABLES FOR_SYM BACKUP_SYM
16256 {
16257 254 Lex->sql_command= SQLCOM_LOCK_TABLES_FOR_BACKUP;
16258 }
16259 | table_or_tables
16260 {
16261 2874 Lex->sql_command= SQLCOM_LOCK_TABLES;
16262 }
16263 table_lock_list
16264 {}
16265 | INSTANCE_SYM FOR_SYM BACKUP_SYM
16266 {
16267 36 Lex->sql_command= SQLCOM_LOCK_INSTANCE;
16268
1/2
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
72 Lex->m_sql_cmd= NEW_PTN Sql_cmd_lock_instance();
16269
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 36 times.
36 if (Lex->m_sql_cmd == nullptr)
16270 MYSQL_YYABORT; // OOM
16271 }
16272 ;
16273
16274 table_or_tables:
16275 TABLE_SYM
16276 | TABLES
16277 ;
16278
16279 table_lock_list:
16280 table_lock
16281 | table_lock_list ',' table_lock
16282 ;
16283
16284 table_lock:
16285 table_ident opt_table_alias lock_option
16286 {
16287 6171 thr_lock_type lock_type= (thr_lock_type) $3;
16288 enum_mdl_type mdl_lock_type;
16289
16290
2/2
✓ Branch 0 taken 1704 times.
✓ Branch 1 taken 4467 times.
6171 if (lock_type >= TL_WRITE_ALLOW_WRITE)
16291 {
16292 /* LOCK TABLE ... WRITE/LOW_PRIORITY WRITE */
16293 1704 mdl_lock_type= MDL_SHARED_NO_READ_WRITE;
16294 }
16295
2/2
✓ Branch 0 taken 2824 times.
✓ Branch 1 taken 1643 times.
4467 else if (lock_type == TL_READ)
16296 {
16297 /* LOCK TABLE ... READ LOCAL */
16298 2824 mdl_lock_type= MDL_SHARED_READ;
16299 }
16300 else
16301 {
16302 /* LOCK TABLE ... READ */
16303 1643 mdl_lock_type= MDL_SHARED_READ_ONLY;
16304 }
16305
16306
2/4
✓ Branch 0 taken 6171 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6171 times.
6171 if (!Select->add_table_to_list(YYTHD, $1, $2.str, 0, lock_type,
16307 mdl_lock_type))
16308 MYSQL_YYABORT;
16309 }
16310 ;
16311
16312 lock_option:
16313 1643 READ_SYM { $$= TL_READ_NO_INSERT; }
16314 1703 | WRITE_SYM { $$= TL_WRITE_DEFAULT; }
16315 | LOW_PRIORITY WRITE_SYM
16316 {
16317 1 $$= TL_WRITE_LOW_PRIORITY;
16318
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "LOW_PRIORITY WRITE", "WRITE");
16319 }
16320 2824 | READ_SYM LOCAL_SYM { $$= TL_READ; }
16321 ;
16322
16323 unlock:
16324 UNLOCK_SYM unlock_variant
16325 {
16326
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 4485 times.
4488 if (Lex->sphead)
16327 {
16328
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_SP_BADSTATEMENT, MYF(0), "UNLOCK");
16329 3 MYSQL_YYABORT;
16330 }
16331 }
16332 ;
16333
16334 unlock_variant:
16335 INSTANCE_SYM
16336 {
16337 31 Lex->sql_command= SQLCOM_UNLOCK_INSTANCE;
16338
1/2
✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
62 Lex->m_sql_cmd= NEW_PTN Sql_cmd_unlock_instance();
16339
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 31 times.
31 if (Lex->m_sql_cmd == nullptr)
16340 MYSQL_YYABORT; // OOM
16341 }
16342 | table_or_tables
16343 {
16344 4457 Lex->sql_command= SQLCOM_UNLOCK_TABLES;
16345 }
16346 ;
16347
16348
16349 shutdown_stmt:
16350 SHUTDOWN
16351 {
16352 7784 Lex->sql_command= SQLCOM_SHUTDOWN;
16353
1/2
✓ Branch 0 taken 7784 times.
✗ Branch 1 not taken.
15568 $$= NEW_PTN PT_shutdown();
16354 }
16355 ;
16356
16357 restart_server_stmt:
16358 RESTART_SYM
16359 {
16360
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
10 $$= NEW_PTN PT_restart_server();
16361 }
16362 ;
16363
16364 alter_instance_stmt:
16365 ALTER INSTANCE_SYM alter_instance_action
16366 {
16367 430 Lex->sql_command= SQLCOM_ALTER_INSTANCE;
16368 430 $$= $3;
16369 }
16370
16371 alter_instance_action:
16372 ROTATE_SYM ident_or_text MASTER_SYM KEY_SYM
16373 {
16374
3/4
✓ Branch 0 taken 260 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 152 times.
✓ Branch 3 taken 108 times.
260 if (is_identifier($2, "INNODB"))
16375 {
16376
1/2
✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
152 $$= NEW_PTN PT_alter_instance(ROTATE_INNODB_MASTER_KEY, EMPTY_CSTR, 0);
16377 }
16378
3/4
✓ Branch 0 taken 108 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 105 times.
✓ Branch 3 taken 3 times.
108 else if (is_identifier($2, "BINLOG"))
16379 {
16380
1/2
✓ Branch 0 taken 105 times.
✗ Branch 1 not taken.
105 $$= NEW_PTN PT_alter_instance(ROTATE_BINLOG_MASTER_KEY, EMPTY_CSTR, 0);
16381 }
16382 else
16383 {
16384
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 YYTHD->syntax_error_at(@2);
16385 3 MYSQL_YYABORT;
16386 }
16387 }
16388 | ROTATE_SYM ident_or_text SYSTEM_SYM KEY_SYM ulong_num
16389 {
16390 if (is_identifier($2, "INNODB"))
16391 {
16392 if ($5 > UINT_MAX32 - 1)
16393 {
16394 my_error(ER_SYSTEM_KEY_ROTATION_MAX_KEY_ID_EXCEEDED, MYF(0));
16395 MYSQL_YYABORT;
16396 }
16397 $$= NEW_PTN PT_alter_instance(ROTATE_INNODB_SYSTEM_KEY, EMPTY_CSTR, $5);
16398 }
16399 else
16400 {
16401 YYTHD->syntax_error_at(@2);
16402 MYSQL_YYABORT;
16403 }
16404 }
16405 | ROTATE_SYM ident_or_text SYSTEM_SYM KEY_SYM
16406 {
16407 if (is_identifier($2, "REDO"))
16408 {
16409 $$= NEW_PTN PT_alter_instance(ROTATE_REDO_SYSTEM_KEY, EMPTY_CSTR, 0);
16410 }
16411 else
16412 {
16413 YYTHD->syntax_error_at(@2);
16414 MYSQL_YYABORT;
16415 }
16416 }
16417 | RELOAD TLS_SYM
16418 {
16419
1/2
✓ Branch 0 taken 98 times.
✗ Branch 1 not taken.
98 $$ = NEW_PTN PT_alter_instance(ALTER_INSTANCE_RELOAD_TLS_ROLLBACK_ON_ERROR, to_lex_cstring("mysql_main"), 0);
16420 }
16421 | RELOAD TLS_SYM NO_SYM ROLLBACK_SYM ON_SYM ERROR_SYM
16422 {
16423
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 $$ = NEW_PTN PT_alter_instance(ALTER_INSTANCE_RELOAD_TLS, to_lex_cstring("mysql_main"), 0);
16424 }
16425 | RELOAD TLS_SYM FOR_SYM CHANNEL_SYM ident {
16426
1/2
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
12 $$ = NEW_PTN PT_alter_instance(ALTER_INSTANCE_RELOAD_TLS_ROLLBACK_ON_ERROR, to_lex_cstring($5), 0);
16427 }
16428 | RELOAD TLS_SYM FOR_SYM CHANNEL_SYM ident NO_SYM ROLLBACK_SYM ON_SYM ERROR_SYM {
16429
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 $$ = NEW_PTN PT_alter_instance(ALTER_INSTANCE_RELOAD_TLS, to_lex_cstring($5), 0);
16430 }
16431 | ENABLE_SYM ident ident
16432 {
16433
2/4
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 21 times.
21 if (!is_identifier($2, "INNODB"))
16434 {
16435 YYTHD->syntax_error_at(@2);
16436 MYSQL_YYABORT;
16437 }
16438
16439
2/4
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 21 times.
21 if (!is_identifier($3, "REDO_LOG"))
16440 {
16441 YYTHD->syntax_error_at(@3);
16442 MYSQL_YYABORT;
16443 }
16444
1/2
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
21 $$ = NEW_PTN PT_alter_instance(ALTER_INSTANCE_ENABLE_INNODB_REDO, EMPTY_CSTR, 0);
16445 }
16446 | DISABLE_SYM ident ident
16447 {
16448
2/4
✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 23 times.
23 if (!is_identifier($2, "INNODB"))
16449 {
16450 YYTHD->syntax_error_at(@2);
16451 MYSQL_YYABORT;
16452 }
16453
16454
2/4
✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 23 times.
23 if (!is_identifier($3, "REDO_LOG"))
16455 {
16456 YYTHD->syntax_error_at(@3);
16457 MYSQL_YYABORT;
16458 }
16459
1/2
✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
23 $$ = NEW_PTN PT_alter_instance(ALTER_INSTANCE_DISABLE_INNODB_REDO, EMPTY_CSTR, 0);
16460 }
16461 | RELOAD KEYRING_SYM {
16462
1/2
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
12 $$ = NEW_PTN PT_alter_instance(RELOAD_KEYRING, EMPTY_CSTR, 0);
16463 }
16464 ;
16465
16466 /*
16467 ** Handler: direct access to ISAM functions
16468 */
16469
16470 handler_stmt:
16471 HANDLER_SYM table_ident OPEN_SYM opt_table_alias
16472 {
16473
2/4
✓ Branch 0 taken 484 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 484 times.
✗ Branch 3 not taken.
484 $$= NEW_PTN PT_handler_open($2, $4);
16474 }
16475 | HANDLER_SYM ident CLOSE_SYM
16476 {
16477
2/4
✓ Branch 0 taken 221 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 221 times.
✗ Branch 3 not taken.
221 $$= NEW_PTN PT_handler_close(to_lex_cstring($2));
16478 }
16479 | HANDLER_SYM /* #1 */
16480 ident /* #2 */
16481 READ_SYM /* #3 */
16482 handler_scan_function /* #4 */
16483 opt_where_clause /* #5 */
16484 opt_limit_clause /* #6 */
16485 {
16486
1/2
✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
294 $$= NEW_PTN PT_handler_table_scan(to_lex_cstring($2), $4, $5, $6);
16487 }
16488 | HANDLER_SYM /* #1 */
16489 ident /* #2 */
16490 READ_SYM /* #3 */
16491 ident /* #4 */
16492 handler_rkey_function /* #5 */
16493 opt_where_clause /* #6 */
16494 opt_limit_clause /* #7 */
16495 {
16496
1/2
✓ Branch 0 taken 268 times.
✗ Branch 1 not taken.
804 $$= NEW_PTN PT_handler_index_scan(to_lex_cstring($2),
16497 804 to_lex_cstring($4), $5, $6, $7);
16498 }
16499 | HANDLER_SYM /* #1 */
16500 ident /* #2 */
16501 READ_SYM /* #3 */
16502 ident /* #4 */
16503 handler_rkey_mode /* #5 */
16504 '(' values ')' /* #6,#7,#8 */
16505 opt_where_clause /* #9 */
16506 opt_limit_clause /* #10 */
16507 {
16508
1/2
✓ Branch 0 taken 68 times.
✗ Branch 1 not taken.
204 $$= NEW_PTN PT_handler_index_range_scan(to_lex_cstring($2),
16509 136 to_lex_cstring($4),
16510 136 $5, $7, $9, $10);
16511 }
16512 ;
16513
16514 handler_scan_function:
16515 181 FIRST_SYM { $$= enum_ha_read_modes::RFIRST; }
16516 113 | NEXT_SYM { $$= enum_ha_read_modes::RNEXT; }
16517 ;
16518
16519 handler_rkey_function:
16520 54 FIRST_SYM { $$= enum_ha_read_modes::RFIRST; }
16521 126 | NEXT_SYM { $$= enum_ha_read_modes::RNEXT; }
16522 66 | PREV_SYM { $$= enum_ha_read_modes::RPREV; }
16523 22 | LAST_SYM { $$= enum_ha_read_modes::RLAST; }
16524 ;
16525
16526 handler_rkey_mode:
16527 48 EQ { $$=HA_READ_KEY_EXACT; }
16528 8 | GE { $$=HA_READ_KEY_OR_NEXT; }
16529 8 | LE { $$=HA_READ_KEY_OR_PREV; }
16530 3 | GT_SYM { $$=HA_READ_AFTER_KEY; }
16531 3 | LT { $$=HA_READ_BEFORE_KEY; }
16532 ;
16533
16534 /* GRANT / REVOKE */
16535
16536 revoke:
16537 REVOKE if_exists role_or_privilege_list FROM user_list opt_ignore_unknown_user
16538 {
16539 257 Lex->grant_if_exists = $2;
16540 257 Lex->ignore_unknown_user = $6;
16541
1/2
✓ Branch 0 taken 257 times.
✗ Branch 1 not taken.
257 auto *tmp= NEW_PTN PT_revoke_roles($3, $5);
16542
5/10
✓ Branch 0 taken 257 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 257 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 257 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 257 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 257 times.
257 MAKE_CMD(tmp);
16543 }
16544 | REVOKE if_exists role_or_privilege_list ON_SYM opt_acl_type grant_ident FROM user_list opt_ignore_unknown_user
16545 {
16546 1908 LEX *lex= Lex;
16547 1908 lex->grant_if_exists = $2;
16548 1908 Lex->ignore_unknown_user = $9;
16549
3/4
✓ Branch 0 taken 1908 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1907 times.
1908 if (apply_privileges(YYTHD, *$3))
16550 1 MYSQL_YYABORT;
16551
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1907 times.
1907 lex->sql_command= (lex->grant == GLOBAL_ACLS) ? SQLCOM_REVOKE_ALL
16552 : SQLCOM_REVOKE;
16553
6/6
✓ Branch 0 taken 54 times.
✓ Branch 1 taken 1853 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 53 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 1906 times.
1907 if ($5 != Acl_type::TABLE && !lex->columns.is_empty())
16554 {
16555
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error();
16556 1 MYSQL_YYABORT;
16557 }
16558 1906 lex->type= static_cast<ulong>($5);
16559 1906 lex->users_list= *$8;
16560 }
16561 | REVOKE if_exists ALL opt_privileges
16562 {
16563 296 Lex->grant_if_exists = $2;
16564 296 Lex->all_privileges= 1;
16565 296 Lex->grant= GLOBAL_ACLS;
16566 }
16567 ON_SYM opt_acl_type grant_ident FROM user_list opt_ignore_unknown_user
16568 {
16569 294 LEX *lex= Lex;
16570
2/2
✓ Branch 0 taken 128 times.
✓ Branch 1 taken 166 times.
294 lex->sql_command= (lex->grant == (GLOBAL_ACLS & ~GRANT_ACL)) ?
16571 SQLCOM_REVOKE_ALL
16572 : SQLCOM_REVOKE;
16573
4/6
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 293 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 294 times.
294 if ($7 != Acl_type::TABLE && !lex->columns.is_empty())
16574 {
16575 YYTHD->syntax_error();
16576 MYSQL_YYABORT;
16577 }
16578 294 lex->type= static_cast<ulong>($7);
16579 294 lex->users_list= *$10;
16580 294 lex->ignore_unknown_user = $11;
16581 }
16582 | REVOKE if_exists ALL opt_privileges ',' GRANT OPTION FROM user_list opt_ignore_unknown_user
16583 {
16584 1572 Lex->grant_if_exists = $2;
16585 1572 Lex->ignore_unknown_user = $10;
16586 1572 Lex->sql_command = SQLCOM_REVOKE_ALL;
16587 1572 Lex->users_list= *$9;
16588 }
16589 | REVOKE if_exists PROXY_SYM ON_SYM user FROM user_list opt_ignore_unknown_user
16590 {
16591 45 LEX *lex= Lex;
16592 45 lex->grant_if_exists = $2;
16593 45 lex->ignore_unknown_user = $8;
16594 45 lex->sql_command= SQLCOM_REVOKE;
16595 45 lex->users_list= *$7;
16596
1/2
✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
45 lex->users_list.push_front ($5);
16597 45 lex->type= TYPE_ENUM_PROXY;
16598 }
16599 ;
16600
16601 grant:
16602 GRANT role_or_privilege_list TO_SYM user_list opt_with_admin_option
16603 {
16604
1/2
✓ Branch 0 taken 958 times.
✗ Branch 1 not taken.
958 auto *tmp= NEW_PTN PT_grant_roles($2, $4, $5);
16605
5/10
✓ Branch 0 taken 958 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 958 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 958 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 958 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 958 times.
958 MAKE_CMD(tmp);
16606 }
16607 | GRANT role_or_privilege_list ON_SYM opt_acl_type grant_ident TO_SYM user_list
16608 grant_options opt_grant_as
16609 {
16610 8096 LEX *lex= Lex;
16611 8096 lex->sql_command= SQLCOM_GRANT;
16612
3/4
✓ Branch 0 taken 8096 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 8092 times.
8096 if (apply_privileges(YYTHD, *$2))
16613 4 MYSQL_YYABORT;
16614
16615
6/6
✓ Branch 0 taken 201 times.
✓ Branch 1 taken 7891 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 200 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 8091 times.
8092 if ($4 != Acl_type::TABLE && !lex->columns.is_empty())
16616 {
16617
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error();
16618 1 MYSQL_YYABORT;
16619 }
16620 8091 lex->type= static_cast<ulong>($4);
16621 8091 lex->users_list= *$7;
16622 }
16623 | GRANT ALL opt_privileges
16624 {
16625 2437 Lex->all_privileges= 1;
16626 2437 Lex->grant= GLOBAL_ACLS;
16627 }
16628 ON_SYM opt_acl_type grant_ident TO_SYM user_list grant_options opt_grant_as
16629 {
16630 2434 LEX *lex= Lex;
16631 2434 lex->sql_command= SQLCOM_GRANT;
16632
4/6
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2430 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2434 times.
2434 if ($6 != Acl_type::TABLE && !lex->columns.is_empty())
16633 {
16634 YYTHD->syntax_error();
16635 MYSQL_YYABORT;
16636 }
16637 2434 lex->type= static_cast<ulong>($6);
16638 2434 lex->users_list= *$9;
16639 }
16640 | GRANT PROXY_SYM ON_SYM user TO_SYM user_list opt_grant_option
16641 {
16642 329 LEX *lex= Lex;
16643 329 lex->sql_command= SQLCOM_GRANT;
16644
2/2
✓ Branch 0 taken 202 times.
✓ Branch 1 taken 127 times.
329 if ($7)
16645 202 lex->grant |= GRANT_ACL;
16646 329 lex->users_list= *$6;
16647
1/2
✓ Branch 0 taken 329 times.
✗ Branch 1 not taken.
329 lex->users_list.push_front ($4);
16648 329 lex->type= TYPE_ENUM_PROXY;
16649 }
16650 ;
16651
16652 opt_acl_type:
16653 12475 /* Empty */ { $$= Acl_type::TABLE; }
16654 39 | TABLE_SYM { $$= Acl_type::TABLE; }
16655 62 | FUNCTION_SYM { $$= Acl_type::FUNCTION; }
16656 209 | PROCEDURE_SYM { $$= Acl_type::PROCEDURE; }
16657 ;
16658
16659 opt_privileges:
16660 /* empty */
16661 | PRIVILEGES
16662 ;
16663
16664 role_or_privilege_list:
16665 role_or_privilege
16666 {
16667
2/4
✓ Branch 0 taken 11272 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11272 times.
✗ Branch 3 not taken.
11272 $$= NEW_PTN Mem_root_array<PT_role_or_privilege *>(YYMEM_ROOT);
16668
4/8
✓ Branch 0 taken 11272 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11272 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 11272 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 11272 times.
11272 if ($$ == NULL || $$->push_back($1))
16669 MYSQL_YYABORT; // OOM
16670 }
16671 | role_or_privilege_list ',' role_or_privilege
16672 {
16673 4959 $$= $1;
16674
2/4
✓ Branch 0 taken 4959 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4959 times.
4959 if ($$->push_back($3))
16675 MYSQL_YYABORT; // OOM
16676 }
16677 ;
16678
16679 role_or_privilege:
16680 role_ident_or_text opt_column_list
16681 {
16682
1/2
✓ Branch 0 taken 4024 times.
✗ Branch 1 not taken.
4024 if ($2 == NULL)
16683
2/4
✓ Branch 0 taken 4024 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4024 times.
✗ Branch 3 not taken.
4024 $$= NEW_PTN PT_role_or_dynamic_privilege(@1, $1);
16684 else
16685 $$= NEW_PTN PT_dynamic_privilege(@1, $1);
16686 }
16687 | role_ident_or_text '@' ident_or_text
16688
2/4
✓ Branch 0 taken 307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 307 times.
✗ Branch 3 not taken.
307 { $$= NEW_PTN PT_role_at_host(@1, $1, $3); }
16689 | SELECT_SYM opt_column_list
16690
2/4
✓ Branch 0 taken 4144 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4144 times.
✗ Branch 3 not taken.
4144 { $$= NEW_PTN PT_static_privilege(@1, SELECT_ACL, $2); }
16691 | INSERT_SYM opt_column_list
16692
2/4
✓ Branch 0 taken 1679 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1679 times.
✗ Branch 3 not taken.
1679 { $$= NEW_PTN PT_static_privilege(@1, INSERT_ACL, $2); }
16693 | UPDATE_SYM opt_column_list
16694
2/4
✓ Branch 0 taken 768 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 768 times.
✗ Branch 3 not taken.
768 { $$= NEW_PTN PT_static_privilege(@1, UPDATE_ACL, $2); }
16695 | REFERENCES opt_column_list
16696
2/4
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
✗ Branch 3 not taken.
37 { $$= NEW_PTN PT_static_privilege(@1, REFERENCES_ACL, $2); }
16697 | DELETE_SYM
16698
2/4
✓ Branch 0 taken 309 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 309 times.
✗ Branch 3 not taken.
309 { $$= NEW_PTN PT_static_privilege(@1, DELETE_ACL); }
16699 | USAGE
16700
2/4
✓ Branch 0 taken 86 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 86 times.
✗ Branch 3 not taken.
86 { $$= NEW_PTN PT_static_privilege(@1, 0); }
16701 | INDEX_SYM
16702
2/4
✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19 times.
✗ Branch 3 not taken.
19 { $$= NEW_PTN PT_static_privilege(@1, INDEX_ACL); }
16703 | ALTER
16704
2/4
✓ Branch 0 taken 264 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 264 times.
✗ Branch 3 not taken.
264 { $$= NEW_PTN PT_static_privilege(@1, ALTER_ACL); }
16705 | CREATE
16706
2/4
✓ Branch 0 taken 625 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 625 times.
✗ Branch 3 not taken.
625 { $$= NEW_PTN PT_static_privilege(@1, CREATE_ACL); }
16707 | DROP
16708
2/4
✓ Branch 0 taken 163 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 163 times.
✗ Branch 3 not taken.
163 { $$= NEW_PTN PT_static_privilege(@1, DROP_ACL); }
16709 | EXECUTE_SYM
16710
2/4
✓ Branch 0 taken 377 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 377 times.
✗ Branch 3 not taken.
377 { $$= NEW_PTN PT_static_privilege(@1, EXECUTE_ACL); }
16711 | RELOAD
16712
2/4
✓ Branch 0 taken 445 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 445 times.
✗ Branch 3 not taken.
445 { $$= NEW_PTN PT_static_privilege(@1, RELOAD_ACL); }
16713 | SHUTDOWN
16714
2/4
✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 206 times.
✗ Branch 3 not taken.
206 { $$= NEW_PTN PT_static_privilege(@1, SHUTDOWN_ACL); }
16715 | PROCESS
16716
2/4
✓ Branch 0 taken 443 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 443 times.
✗ Branch 3 not taken.
443 { $$= NEW_PTN PT_static_privilege(@1, PROCESS_ACL); }
16717 | FILE_SYM
16718
2/4
✓ Branch 0 taken 51 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 51 times.
✗ Branch 3 not taken.
51 { $$= NEW_PTN PT_static_privilege(@1, FILE_ACL); }
16719 | GRANT OPTION
16720 {
16721
2/4
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
✗ Branch 3 not taken.
32 $$= NEW_PTN PT_static_privilege(@1, GRANT_ACL);
16722 32 Lex->grant_privilege= true;
16723 }
16724 | SHOW DATABASES
16725
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 { $$= NEW_PTN PT_static_privilege(@1, SHOW_DB_ACL); }
16726 | SUPER_SYM
16727 {
16728 /* DEPRECATED */
16729
2/4
✓ Branch 0 taken 672 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 672 times.
✗ Branch 3 not taken.
672 $$= NEW_PTN PT_static_privilege(@1, SUPER_ACL);
16730
1/2
✓ Branch 0 taken 672 times.
✗ Branch 1 not taken.
672 if (Lex->grant != GLOBAL_ACLS)
16731 {
16732 /*
16733 An explicit request was made for the SUPER priv id
16734 */
16735
1/2
✓ Branch 0 taken 672 times.
✗ Branch 1 not taken.
672 push_warning(Lex->thd, Sql_condition::SL_WARNING,
16736 ER_WARN_DEPRECATED_SYNTAX,
16737 "The SUPER privilege identifier is deprecated");
16738 }
16739 }
16740 | CREATE TEMPORARY TABLES
16741
2/4
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
15 { $$= NEW_PTN PT_static_privilege(@1, CREATE_TMP_ACL); }
16742 | LOCK_SYM TABLES
16743
2/4
✓ Branch 0 taken 417 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 417 times.
✗ Branch 3 not taken.
417 { $$= NEW_PTN PT_static_privilege(@1, LOCK_TABLES_ACL); }
16744 | REPLICATION SLAVE
16745
2/4
✓ Branch 0 taken 153 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
✗ Branch 3 not taken.
153 { $$= NEW_PTN PT_static_privilege(@1, REPL_SLAVE_ACL); }
16746 | REPLICATION CLIENT_SYM
16747
2/4
✓ Branch 0 taken 410 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 410 times.
✗ Branch 3 not taken.
410 { $$= NEW_PTN PT_static_privilege(@1, REPL_CLIENT_ACL); }
16748 | CREATE VIEW_SYM
16749
2/4
✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 54 times.
✗ Branch 3 not taken.
54 { $$= NEW_PTN PT_static_privilege(@1, CREATE_VIEW_ACL); }
16750 | SHOW VIEW_SYM
16751
2/4
✓ Branch 0 taken 71 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 71 times.
✗ Branch 3 not taken.
71 { $$= NEW_PTN PT_static_privilege(@1, SHOW_VIEW_ACL); }
16752 | CREATE ROUTINE_SYM
16753
2/4
✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 83 times.
✗ Branch 3 not taken.
83 { $$= NEW_PTN PT_static_privilege(@1, CREATE_PROC_ACL); }
16754 | ALTER ROUTINE_SYM
16755
2/4
✓ Branch 0 taken 55 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 55 times.
✗ Branch 3 not taken.
55 { $$= NEW_PTN PT_static_privilege(@1, ALTER_PROC_ACL); }
16756 | CREATE USER
16757
2/4
✓ Branch 0 taken 66 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 66 times.
✗ Branch 3 not taken.
66 { $$= NEW_PTN PT_static_privilege(@1, CREATE_USER_ACL); }
16758 | EVENT_SYM
16759
2/4
✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35 times.
✗ Branch 3 not taken.
35 { $$= NEW_PTN PT_static_privilege(@1, EVENT_ACL); }
16760 | TRIGGER_SYM
16761
2/4
✓ Branch 0 taken 178 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 178 times.
✗ Branch 3 not taken.
178 { $$= NEW_PTN PT_static_privilege(@1, TRIGGER_ACL); }
16762 | CREATE TABLESPACE_SYM
16763
2/4
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
25 { $$= NEW_PTN PT_static_privilege(@1, CREATE_TABLESPACE_ACL); }
16764 | CREATE ROLE_SYM
16765
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
6 { $$= NEW_PTN PT_static_privilege(@1, CREATE_ROLE_ACL); }
16766 | DROP ROLE_SYM
16767
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 { $$= NEW_PTN PT_static_privilege(@1, DROP_ROLE_ACL); }
16768 ;
16769
16770 opt_with_admin_option:
16771 930 /* empty */ { $$= false; }
16772 28 | WITH ADMIN_SYM OPTION { $$= true; }
16773 ;
16774
16775 opt_and:
16776 /* empty */
16777 | AND_SYM
16778 ;
16779
16780 require_list:
16781 require_list_element opt_and require_list
16782 | require_list_element
16783 ;
16784
16785 require_list_element:
16786 SUBJECT_SYM TEXT_STRING
16787 {
16788 135 LEX *lex=Lex;
16789
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 135 times.
135 if (lex->x509_subject)
16790 {
16791 my_error(ER_DUP_ARGUMENT, MYF(0), "SUBJECT");
16792 MYSQL_YYABORT;
16793 }
16794 135 lex->x509_subject=$2.str;
16795 }
16796 | ISSUER_SYM TEXT_STRING
16797 {
16798 128 LEX *lex=Lex;
16799
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 128 times.
128 if (lex->x509_issuer)
16800 {
16801 my_error(ER_DUP_ARGUMENT, MYF(0), "ISSUER");
16802 MYSQL_YYABORT;
16803 }
16804 128 lex->x509_issuer=$2.str;
16805 }
16806 | CIPHER_SYM TEXT_STRING
16807 {
16808 112 LEX *lex=Lex;
16809
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 112 times.
112 if (lex->ssl_cipher)
16810 {
16811 my_error(ER_DUP_ARGUMENT, MYF(0), "CIPHER");
16812 MYSQL_YYABORT;
16813 }
16814 112 lex->ssl_cipher=$2.str;
16815 }
16816 ;
16817
16818 grant_ident:
16819 '*'
16820 {
16821 6 LEX *lex= Lex;
16822 size_t dummy;
16823
3/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 4 times.
6 if (lex->copy_db_to(&lex->current_query_block()->db, &dummy))
16824 2 MYSQL_YYABORT;
16825
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
4 if (lex->grant == GLOBAL_ACLS)
16826 1 lex->grant = DB_OP_ACLS;
16827
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 else if (lex->columns.elements)
16828 {
16829 my_error(ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0));
16830 MYSQL_YYABORT;
16831 }
16832 }
16833 | schema '.' '*'
16834 {
16835 2800 LEX *lex= Lex;
16836 2800 lex->current_query_block()->db = $1.str;
16837
2/2
✓ Branch 0 taken 420 times.
✓ Branch 1 taken 2380 times.
2800 if (lex->grant == GLOBAL_ACLS)
16838 420 lex->grant = DB_OP_ACLS;
16839
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2380 times.
2380 else if (lex->columns.elements)
16840 {
16841 my_error(ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0));
16842 MYSQL_YYABORT;
16843 }
16844 }
16845 | '*' '.' '*'
16846 {
16847 7753 LEX *lex= Lex;
16848 7753 lex->current_query_block()->db = NULL;
16849
2/2
✓ Branch 0 taken 2125 times.
✓ Branch 1 taken 5628 times.
7753 if (lex->grant == GLOBAL_ACLS)
16850 2125 lex->grant= GLOBAL_ACLS & ~GRANT_ACL;
16851
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5628 times.
5628 else if (lex->columns.elements)
16852 {
16853 my_error(ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0));
16854 MYSQL_YYABORT;
16855 }
16856 }
16857 | ident
16858 {
16859
1/2
✓ Branch 0 taken 623 times.
✗ Branch 1 not taken.
623 auto tmp = NEW_PTN Table_ident(to_lex_cstring($1));
16860
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 623 times.
623 if (tmp == NULL)
16861 MYSQL_YYABORT;
16862 623 LEX *lex=Lex;
16863
3/4
✓ Branch 0 taken 623 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 619 times.
623 if (!lex->current_query_block()->add_table_to_list(lex->thd, tmp, NULL,
16864 TL_OPTION_UPDATING))
16865 4 MYSQL_YYABORT;
16866
2/2
✓ Branch 0 taken 44 times.
✓ Branch 1 taken 575 times.
619 if (lex->grant == GLOBAL_ACLS)
16867 44 lex->grant = TABLE_OP_ACLS;
16868 }
16869 | schema '.' ident
16870 {
16871
1/2
✓ Branch 0 taken 1603 times.
✗ Branch 1 not taken.
1603 auto schema_name = YYCLIENT_NO_SCHEMA ? LEX_CSTRING{}
16872
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1603 times.
1603 : to_lex_cstring($1.str);
16873
1/2
✓ Branch 0 taken 1603 times.
✗ Branch 1 not taken.
1603 auto tmp = NEW_PTN Table_ident(schema_name, to_lex_cstring($3));
16874
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1603 times.
1603 if (tmp == NULL)
16875 MYSQL_YYABORT;
16876 1603 LEX *lex=Lex;
16877
2/4
✓ Branch 0 taken 1603 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1603 times.
1603 if (!lex->current_query_block()->add_table_to_list(lex->thd, tmp, NULL,
16878 TL_OPTION_UPDATING))
16879 MYSQL_YYABORT;
16880
2/2
✓ Branch 0 taken 138 times.
✓ Branch 1 taken 1465 times.
1603 if (lex->grant == GLOBAL_ACLS)
16881 138 lex->grant = TABLE_OP_ACLS;
16882 }
16883 ;
16884
16885 user_list:
16886 user
16887 {
16888
1/2
✓ Branch 0 taken 21640 times.
✗ Branch 1 not taken.
21640 $$= new (YYMEM_ROOT) List<LEX_USER>;
16889
4/8
✓ Branch 0 taken 21640 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21640 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 21640 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 21640 times.
21640 if ($$ == NULL || $$->push_back($1))
16890 MYSQL_YYABORT;
16891 }
16892 | user_list ',' user
16893 {
16894 2284 $$= $1;
16895
2/4
✓ Branch 0 taken 2284 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2284 times.
2284 if ($$->push_back($3))
16896 MYSQL_YYABORT;
16897 }
16898 ;
16899
16900 role_list:
16901 role
16902 {
16903
1/2
✓ Branch 0 taken 2674 times.
✗ Branch 1 not taken.
2674 $$= new (YYMEM_ROOT) List<LEX_USER>;
16904
4/8
✓ Branch 0 taken 2674 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2674 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2674 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2674 times.
2674 if ($$ == NULL || $$->push_back($1))
16905 MYSQL_YYABORT;
16906 }
16907 | role_list ',' role
16908 {
16909 560 $$= $1;
16910
2/4
✓ Branch 0 taken 560 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 560 times.
560 if ($$->push_back($3))
16911 MYSQL_YYABORT;
16912 }
16913 ;
16914
16915 opt_retain_current_password:
16916 2287 /* empty */ { $$= false; }
16917 60 | RETAIN_SYM CURRENT_SYM PASSWORD { $$= true; }
16918 ;
16919
16920 opt_discard_old_password:
16921 1410 /* empty */ { $$= false; }
16922 41 | DISCARD_SYM OLD_SYM PASSWORD { $$= true; }
16923
16924
16925 opt_user_registration:
16926 factor INITIATE_SYM REGISTRATION_SYM
16927 {
16928 LEX_MFA *m = NEW_PTN LEX_MFA;
16929 if (m == nullptr)
16930 MYSQL_YYABORT; // OOM
16931 m->nth_factor= $1;
16932 m->init_registration= true;
16933 m->requires_registration= true;
16934 $$ = m;
16935 }
16936 | factor UNREGISTER_SYM
16937 {
16938 LEX_MFA *m = NEW_PTN LEX_MFA;
16939 if (m == nullptr)
16940 MYSQL_YYABORT; // OOM
16941 m->nth_factor= $1;
16942 m->unregister= true;
16943 $$ = m;
16944 }
16945 | factor FINISH_SYM REGISTRATION_SYM SET_SYM CHALLENGE_RESPONSE_SYM AS TEXT_STRING_hash
16946 {
16947 LEX_MFA *m = NEW_PTN LEX_MFA;
16948 if (m == nullptr)
16949 MYSQL_YYABORT; // OOM
16950 m->nth_factor= $1;
16951 m->finish_registration= true;
16952 m->requires_registration= true;
16953 m->challenge_response= to_lex_cstring($7);
16954 $$ = m;
16955 }
16956 ;
16957
16958 create_user:
16959 user identification opt_create_user_with_mfa
16960 {
16961 4412 $$ = $1;
16962 4412 $$->first_factor_auth_info = *$2;
16963
2/4
✓ Branch 0 taken 4412 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4412 times.
4412 if ($$->add_mfa_identifications($3.mfa2, $3.mfa3))
16964 MYSQL_YYABORT; // OOM
16965 }
16966 | user identified_with_plugin opt_initial_auth
16967 {
16968 $$= $1;
16969 /* set $3 as first factor auth method */
16970 $3->nth_factor = 1;
16971 $3->passwordless = false;
16972 $$->first_factor_auth_info = *$3;
16973 /* set $2 as second factor auth method */
16974 $2->nth_factor = 2;
16975 $2->passwordless = true;
16976 if ($$->mfa_list.push_back($2))
16977 MYSQL_YYABORT; // OOM
16978 $$->with_initial_auth = true;
16979 }
16980 | user opt_create_user_with_mfa
16981 {
16982 3634 $$ = $1;
16983
2/4
✓ Branch 0 taken 3634 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3634 times.
3634 if ($$->add_mfa_identifications($2.mfa2, $2.mfa3))
16984 MYSQL_YYABORT; // OOM
16985 }
16986 ;
16987
16988 opt_create_user_with_mfa:
16989 8046 /* empty */ { $$ = {}; }
16990 | AND_SYM identification
16991 {
16992 $2->nth_factor = 2;
16993 $$ = {$2, nullptr};
16994 }
16995 | AND_SYM identification AND_SYM identification
16996 {
16997 $2->nth_factor = 2;
16998 $4->nth_factor = 3;
16999 $$ = {$2, $4};
17000 }
17001 ;
17002
17003 identification:
17004 identified_by_password
17005 | identified_by_random_password
17006 | identified_with_plugin
17007 | identified_with_plugin_as_auth
17008 | identified_with_plugin_by_password
17009 | identified_with_plugin_by_random_password
17010 ;
17011
17012 identified_by_password:
17013 IDENTIFIED_SYM BY TEXT_STRING_password
17014 {
17015
2/4
✓ Branch 0 taken 2788 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2788 times.
✗ Branch 3 not taken.
2788 LEX_MFA *m = NEW_PTN LEX_MFA;
17016
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2788 times.
2788 if (m == nullptr)
17017 MYSQL_YYABORT; // OOM
17018 2788 m->auth = to_lex_cstring($3);
17019 2788 m->uses_identified_by_clause = true;
17020 2788 $$ = m;
17021 2788 Lex->contains_plaintext_password= true;
17022 }
17023 ;
17024
17025 identified_by_random_password:
17026 IDENTIFIED_SYM BY RANDOM_SYM PASSWORD
17027 {
17028
2/4
✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✗ Branch 3 not taken.
133 LEX_MFA *m = NEW_PTN LEX_MFA;
17029
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 133 times.
133 if (m == nullptr)
17030 MYSQL_YYABORT; // OOM
17031 133 m->auth = EMPTY_CSTR;
17032 133 m->has_password_generator = true;
17033 133 m->uses_identified_by_clause = true;
17034 133 $$ = m;
17035 133 Lex->contains_plaintext_password = true;
17036 }
17037 ;
17038
17039 identified_with_plugin:
17040 IDENTIFIED_SYM WITH ident_or_text
17041 {
17042
2/4
✓ Branch 0 taken 1289 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1289 times.
✗ Branch 3 not taken.
1289 LEX_MFA *m = NEW_PTN LEX_MFA;
17043
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1289 times.
1289 if (m == nullptr)
17044 MYSQL_YYABORT; // OOM
17045 1289 m->plugin = to_lex_cstring($3);
17046 1289 m->auth = EMPTY_CSTR;
17047 1289 m->uses_identified_by_clause = false;
17048 1289 m->uses_identified_with_clause = true;
17049 1289 $$ = m;
17050 }
17051 ;
17052
17053 identified_with_plugin_as_auth:
17054 IDENTIFIED_SYM WITH ident_or_text AS TEXT_STRING_hash
17055 {
17056
2/4
✓ Branch 0 taken 1215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1215 times.
✗ Branch 3 not taken.
1215 LEX_MFA *m = NEW_PTN LEX_MFA;
17057
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1215 times.
1215 if (m == nullptr)
17058 MYSQL_YYABORT; // OOM
17059 1215 m->plugin = to_lex_cstring($3);
17060 1215 m->auth = to_lex_cstring($5);
17061 1215 m->uses_authentication_string_clause = true;
17062 1215 m->uses_identified_with_clause = true;
17063 1215 $$ = m;
17064 }
17065 ;
17066
17067 identified_with_plugin_by_password:
17068 IDENTIFIED_SYM WITH ident_or_text BY TEXT_STRING_password
17069 {
17070
2/4
✓ Branch 0 taken 501 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 501 times.
✗ Branch 3 not taken.
501 LEX_MFA *m = NEW_PTN LEX_MFA;
17071
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 501 times.
501 if (m == nullptr)
17072 MYSQL_YYABORT; // OOM
17073 501 m->plugin = to_lex_cstring($3);
17074 501 m->auth = to_lex_cstring($5);
17075 501 m->uses_identified_by_clause = true;
17076 501 m->uses_identified_with_clause = true;
17077 501 $$ = m;
17078 501 Lex->contains_plaintext_password= true;
17079 }
17080 ;
17081
17082 identified_with_plugin_by_random_password:
17083 IDENTIFIED_SYM WITH ident_or_text BY RANDOM_SYM PASSWORD
17084 {
17085
2/4
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
7 LEX_MFA *m = NEW_PTN LEX_MFA;
17086
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
7 if (m == nullptr)
17087 MYSQL_YYABORT; // OOM
17088 7 m->plugin = to_lex_cstring($3);
17089 7 m->uses_identified_by_clause = true;
17090 7 m->uses_identified_with_clause = true;
17091 7 m->has_password_generator = true;
17092 7 $$ = m;
17093 7 Lex->contains_plaintext_password= true;
17094 }
17095 ;
17096
17097 opt_initial_auth:
17098 INITIAL_SYM AUTHENTICATION_SYM identified_by_random_password
17099 {
17100 $$ = $3;
17101 $3->passwordless = true;
17102 $3->nth_factor = 2;
17103 }
17104 | INITIAL_SYM AUTHENTICATION_SYM identified_with_plugin_as_auth
17105 {
17106 $$ = $3;
17107 $3->passwordless = true;
17108 $3->nth_factor = 2;
17109 }
17110 | INITIAL_SYM AUTHENTICATION_SYM identified_by_password
17111 {
17112 $$ = $3;
17113 $3->passwordless = true;
17114 $3->nth_factor = 2;
17115 }
17116 ;
17117
17118 alter_user:
17119 user identified_by_password
17120 REPLACE_SYM TEXT_STRING_password
17121 opt_retain_current_password
17122 {
17123 147 $$ = $1;
17124 147 $1->first_factor_auth_info = *$2;
17125 147 $1->current_auth = to_lex_cstring($4);
17126 147 $1->uses_replace_clause = true;
17127 147 $1->discard_old_password = false;
17128 147 $1->retain_current_password = $5;
17129 }
17130 | user identified_with_plugin_by_password
17131 REPLACE_SYM TEXT_STRING_password
17132 opt_retain_current_password
17133 {
17134 $$ = $1;
17135 $1->first_factor_auth_info = *$2;
17136 $1->current_auth = to_lex_cstring($4);
17137 $1->uses_replace_clause = true;
17138 $1->discard_old_password = false;
17139 $1->retain_current_password = $5;
17140 }
17141 | user identified_by_password opt_retain_current_password
17142 {
17143 770 $$ = $1;
17144 770 $1->first_factor_auth_info = *$2;
17145 770 $1->discard_old_password = false;
17146 770 $1->retain_current_password = $3;
17147 }
17148 | user identified_by_random_password opt_retain_current_password
17149 {
17150 55 $$ = $1;
17151 55 $1->first_factor_auth_info = *$2;
17152 55 $1->discard_old_password = false;
17153 55 $1->retain_current_password = $3;
17154 }
17155 | user identified_by_random_password
17156 REPLACE_SYM TEXT_STRING_password
17157 opt_retain_current_password
17158 {
17159 3 $$ = $1;
17160 3 $1->first_factor_auth_info = *$2;
17161 3 $1->uses_replace_clause = true;
17162 3 $1->discard_old_password = false;
17163 3 $1->retain_current_password = $5;
17164 3 $1->current_auth = to_lex_cstring($4);
17165 }
17166 | user identified_with_plugin
17167 {
17168 102 $$ = $1;
17169 102 $1->first_factor_auth_info = *$2;
17170 102 $1->discard_old_password = false;
17171 102 $1->retain_current_password = false;
17172 }
17173 | user identified_with_plugin_as_auth opt_retain_current_password
17174 {
17175 194 $$ = $1;
17176 194 $1->first_factor_auth_info = *$2;
17177 194 $1->discard_old_password = false;
17178 194 $1->retain_current_password = $3;
17179 }
17180 | user identified_with_plugin_by_password opt_retain_current_password
17181 {
17182 74 $$ = $1;
17183 74 $1->first_factor_auth_info = *$2;
17184 74 $1->discard_old_password = false;
17185 74 $1->retain_current_password = $3;
17186 }
17187 | user identified_with_plugin_by_random_password
17188 opt_retain_current_password
17189 {
17190 6 $$ = $1;
17191 6 $1->first_factor_auth_info = *$2;
17192 6 $1->discard_old_password= false;
17193 6 $1->retain_current_password= $3;
17194 }
17195 | user opt_discard_old_password
17196 {
17197 1451 $$ = $1;
17198 1451 $1->discard_old_password = $2;
17199 1451 $1->retain_current_password = false;
17200 }
17201 | user ADD factor identification
17202 {
17203 $4->nth_factor = $3;
17204 $4->add_factor = true;
17205 if ($1->add_mfa_identifications($4))
17206 MYSQL_YYABORT; // OOM
17207 $$ = $1;
17208 }
17209 | user ADD factor identification ADD factor identification
17210 {
17211 if ($3 == $6) {
17212 my_error(ER_MFA_METHODS_IDENTICAL, MYF(0));
17213 MYSQL_YYABORT;
17214 } else if ($3 > $6) {
17215 my_error(ER_MFA_METHODS_INVALID_ORDER, MYF(0), $6, $3);
17216 MYSQL_YYABORT;
17217 }
17218 $4->nth_factor = $3;
17219 $4->add_factor = true;
17220 $7->nth_factor = $6;
17221 $7->add_factor = true;
17222 if ($1->add_mfa_identifications($4, $7))
17223 MYSQL_YYABORT; // OOM
17224 $$ = $1;
17225 }
17226 | user MODIFY_SYM factor identification
17227 {
17228 $4->nth_factor = $3;
17229 $4->modify_factor = true;
17230 if ($1->add_mfa_identifications($4))
17231 MYSQL_YYABORT; // OOM
17232 $$ = $1;
17233 }
17234 | user MODIFY_SYM factor identification MODIFY_SYM factor identification
17235 {
17236 if ($3 == $6) {
17237 my_error(ER_MFA_METHODS_IDENTICAL, MYF(0));
17238 MYSQL_YYABORT;
17239 }
17240 $4->nth_factor = $3;
17241 $4->modify_factor = true;
17242 $7->nth_factor = $6;
17243 $7->modify_factor = true;
17244 if ($1->add_mfa_identifications($4, $7))
17245 MYSQL_YYABORT; // OOM
17246 $$ = $1;
17247 }
17248 | user DROP factor
17249 {
17250 LEX_MFA *m = NEW_PTN LEX_MFA;
17251 if (m == nullptr)
17252 MYSQL_YYABORT; // OOM
17253 m->nth_factor = $3;
17254 m->drop_factor = true;
17255 if ($1->add_mfa_identifications(m))
17256 MYSQL_YYABORT; // OOM
17257 $$ = $1;
17258 }
17259 | user DROP factor DROP factor
17260 {
17261 if ($3 == $5) {
17262 my_error(ER_MFA_METHODS_IDENTICAL, MYF(0));
17263 MYSQL_YYABORT;
17264 }
17265 LEX_MFA *m1 = NEW_PTN LEX_MFA;
17266 if (m1 == nullptr)
17267 MYSQL_YYABORT; // OOM
17268 m1->nth_factor = $3;
17269 m1->drop_factor = true;
17270 LEX_MFA *m2 = NEW_PTN LEX_MFA;
17271 if (m2 == nullptr)
17272 MYSQL_YYABORT; // OOM
17273 m2->nth_factor = $5;
17274 m2->drop_factor = true;
17275 if ($1->add_mfa_identifications(m1, m2))
17276 MYSQL_YYABORT; // OOM
17277 $$ = $1;
17278 }
17279 ;
17280
17281 factor:
17282 NUM FACTOR_SYM
17283 {
17284 if (my_strcasecmp(system_charset_info, $1.str, "2") == 0) {
17285 $$ = 2;
17286 } else if (my_strcasecmp(system_charset_info, $1.str, "3") == 0) {
17287 $$ = 3;
17288 } else {
17289 my_error(ER_WRONG_VALUE, MYF(0), "nth factor", $1.str);
17290 MYSQL_YYABORT;
17291 }
17292 }
17293 ;
17294
17295 create_user_list:
17296 create_user
17297 {
17298
2/4
✓ Branch 0 taken 6828 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6828 times.
6828 if (Lex->users_list.push_back($1))
17299 MYSQL_YYABORT;
17300 }
17301 | create_user_list ',' create_user
17302 {
17303
2/4
✓ Branch 0 taken 1218 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1218 times.
1218 if (Lex->users_list.push_back($3))
17304 MYSQL_YYABORT;
17305 }
17306 ;
17307
17308 alter_user_list:
17309 alter_user
17310 {
17311
2/4
✓ Branch 0 taken 2405 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2405 times.
2405 if (Lex->users_list.push_back($1))
17312 MYSQL_YYABORT;
17313 }
17314 | alter_user_list ',' alter_user
17315 {
17316
2/4
✓ Branch 0 taken 397 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 397 times.
397 if (Lex->users_list.push_back($3))
17317 MYSQL_YYABORT;
17318 }
17319 ;
17320
17321 opt_column_list:
17322 10174 /* empty */ { $$= NULL; }
17323 478 | '(' column_list ')' { $$= $2; }
17324 ;
17325
17326 column_list:
17327 ident
17328 {
17329
1/2
✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
478 $$= NEW_PTN Mem_root_array<LEX_CSTRING>(YYMEM_ROOT);
17330
4/8
✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 478 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 478 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 478 times.
478 if ($$ == NULL || $$->push_back(to_lex_cstring($1)))
17331 MYSQL_YYABORT; // OOM
17332 }
17333 | column_list ',' ident
17334 {
17335 93 $$= $1;
17336
2/4
✓ Branch 0 taken 93 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 93 times.
93 if ($$->push_back(to_lex_cstring($3)))
17337 MYSQL_YYABORT; // OOM
17338 }
17339 ;
17340
17341 require_clause:
17342 /* empty */
17343 | REQUIRE_SYM require_list
17344 {
17345 245 Lex->ssl_type=SSL_TYPE_SPECIFIED;
17346 }
17347 | REQUIRE_SYM SSL_SYM
17348 {
17349 147 Lex->ssl_type=SSL_TYPE_ANY;
17350 }
17351 | REQUIRE_SYM X509_SYM
17352 {
17353 47 Lex->ssl_type=SSL_TYPE_X509;
17354 }
17355 | REQUIRE_SYM NONE_SYM
17356 {
17357 56 Lex->ssl_type=SSL_TYPE_NONE;
17358 }
17359 ;
17360
17361 grant_options:
17362 /* empty */ {}
17363 | WITH GRANT OPTION
17364 1343 { Lex->grant |= GRANT_ACL;}
17365 ;
17366
17367 opt_grant_option:
17368 127 /* empty */ { $$= false; }
17369 202 | WITH GRANT OPTION { $$= true; }
17370 ;
17371 opt_with_roles:
17372 /* empty */
17373 20 { Lex->grant_as.role_type = role_enum::ROLE_NONE; }
17374 | WITH ROLE_SYM role_list
17375 64 { Lex->grant_as.role_type = role_enum::ROLE_NAME;
17376 64 Lex->grant_as.role_list = $3;
17377 }
17378 | WITH ROLE_SYM ALL opt_except_role_list
17379 {
17380 47 Lex->grant_as.role_type = role_enum::ROLE_ALL;
17381 47 Lex->grant_as.role_list = $4;
17382 }
17383 | WITH ROLE_SYM NONE_SYM
17384 293 { Lex->grant_as.role_type = role_enum::ROLE_NONE; }
17385 | WITH ROLE_SYM DEFAULT_SYM
17386 22 { Lex->grant_as.role_type = role_enum::ROLE_DEFAULT; }
17387
17388 opt_grant_as:
17389 /* empty */
17390 10084 { Lex->grant_as.grant_as_used = false; }
17391 | AS user opt_with_roles
17392 {
17393 446 Lex->grant_as.grant_as_used = true;
17394 446 Lex->grant_as.user = $2;
17395 }
17396
17397 begin_stmt:
17398 BEGIN_SYM
17399 {
17400 336899 LEX *lex=Lex;
17401 336899 lex->sql_command = SQLCOM_BEGIN;
17402 336899 lex->start_transaction_opt= 0;
17403 }
17404 opt_work {}
17405 ;
17406
17407 opt_work:
17408 /* empty */ {}
17409 | WORK_SYM {}
17410 ;
17411
17412 opt_chain:
17413 /* empty */
17414 244568 { $$= TVL_UNKNOWN; }
17415 12 | AND_SYM NO_SYM CHAIN_SYM { $$= TVL_NO; }
17416 22 | AND_SYM CHAIN_SYM { $$= TVL_YES; }
17417 ;
17418
17419 opt_release:
17420 /* empty */
17421 244629 { $$= TVL_UNKNOWN; }
17422 7 | RELEASE_SYM { $$= TVL_YES; }
17423 4 | NO_SYM RELEASE_SYM { $$= TVL_NO; }
17424 ;
17425
17426 opt_savepoint:
17427 /* empty */ {}
17428 | SAVEPOINT_SYM {}
17429 ;
17430
17431 commit:
17432 COMMIT_SYM opt_work opt_chain opt_release
17433 {
17434 233856 LEX *lex=Lex;
17435 233856 lex->sql_command= SQLCOM_COMMIT;
17436 /* Don't allow AND CHAIN RELEASE. */
17437
5/6
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 233839 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
233856 MYSQL_YYABORT_UNLESS($3 != TVL_YES || $4 != TVL_YES);
17438 233855 lex->tx_chain= $3;
17439 233855 lex->tx_release= $4;
17440 }
17441 ;
17442
17443 rollback:
17444 ROLLBACK_SYM opt_work opt_chain opt_release
17445 {
17446 10575 LEX *lex=Lex;
17447 10575 lex->sql_command= SQLCOM_ROLLBACK;
17448 /* Don't allow AND CHAIN RELEASE. */
17449
5/6
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 10570 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
10575 MYSQL_YYABORT_UNLESS($3 != TVL_YES || $4 != TVL_YES);
17450 10574 lex->tx_chain= $3;
17451 10574 lex->tx_release= $4;
17452 }
17453 | ROLLBACK_SYM opt_work
17454 TO_SYM opt_savepoint ident
17455 {
17456 3234 LEX *lex=Lex;
17457 3234 lex->sql_command= SQLCOM_ROLLBACK_TO_SAVEPOINT;
17458 3234 lex->ident= $5;
17459 }
17460 ;
17461
17462 savepoint:
17463 SAVEPOINT_SYM ident
17464 {
17465 6107 LEX *lex=Lex;
17466 6107 lex->sql_command= SQLCOM_SAVEPOINT;
17467 6107 lex->ident= $2;
17468 }
17469 ;
17470
17471 release:
17472 RELEASE_SYM SAVEPOINT_SYM ident
17473 {
17474 72 LEX *lex=Lex;
17475 72 lex->sql_command= SQLCOM_RELEASE_SAVEPOINT;
17476 72 lex->ident= $3;
17477 }
17478 ;
17479
17480 /*
17481 UNIONS : glue selects together
17482 */
17483
17484
17485 union_option:
17486 25602 /* empty */ { $$=1; }
17487 225 | DISTINCT { $$=1; }
17488 36168 | ALL { $$=0; }
17489 ;
17490
17491 row_subquery:
17492 subquery
17493 ;
17494
17495 table_subquery:
17496 subquery
17497 ;
17498
17499 subquery:
17500 query_expression_parens %prec SUBQUERY_AS_EXPR
17501 {
17502
2/4
✓ Branch 0 taken 287531 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 287531 times.
✗ Branch 3 not taken.
287531 $$= NEW_PTN PT_subquery(@$, $1);
17503 }
17504 ;
17505
17506 query_spec_option:
17507 464 STRAIGHT_JOIN { $$= SELECT_STRAIGHT_JOIN; }
17508 29 | HIGH_PRIORITY { $$= SELECT_HIGH_PRIORITY; }
17509 12017 | DISTINCT { $$= SELECT_DISTINCT; }
17510 37 | SQL_SMALL_RESULT { $$= SELECT_SMALL_RESULT; }
17511 89 | SQL_BIG_RESULT { $$= SELECT_BIG_RESULT; }
17512 43 | SQL_BUFFER_RESULT { $$= OPTION_BUFFER_RESULT; }
17513 | SQL_CALC_FOUND_ROWS {
17514
2/4
✓ Branch 0 taken 147 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 147 times.
✗ Branch 3 not taken.
147 push_warning(YYTHD, Sql_condition::SL_WARNING,
17515 ER_WARN_DEPRECATED_SYNTAX,
17516 ER_THD(YYTHD, ER_WARN_DEPRECATED_SQL_CALC_FOUND_ROWS));
17517 147 $$= OPTION_FOUND_ROWS;
17518 }
17519 37 | ALL { $$= SELECT_ALL; }
17520 ;
17521
17522 /**************************************************************************
17523
17524 CREATE VIEW | TRIGGER | PROCEDURE statements.
17525
17526 **************************************************************************/
17527
17528 init_lex_create_info:
17529 /* empty */
17530 {
17531 // Initialize context for 'CREATE view_or_trigger_or_sp_or_event'
17532
1/2
✓ Branch 0 taken 345423 times.
✗ Branch 1 not taken.
345418 Lex->create_info= YYTHD->alloc_typed<HA_CREATE_INFO>();
17533
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 345423 times.
345423 if (Lex->create_info == NULL)
17534 MYSQL_YYABORT; // OOM
17535 }
17536 ;
17537
17538 view_or_trigger_or_sp_or_event:
17539 definer init_lex_create_info definer_tail
17540 {}
17541 | no_definer init_lex_create_info no_definer_tail
17542 {}
17543 | view_replace_or_algorithm definer_opt init_lex_create_info view_tail
17544 {}
17545 ;
17546
17547 definer_tail:
17548 view_tail
17549 | trigger_tail
17550 | sp_tail
17551 | sf_tail
17552 | event_tail
17553 ;
17554
17555 no_definer_tail:
17556 view_tail
17557 | trigger_tail
17558 | sp_tail
17559 | sf_tail
17560 | udf_tail
17561 | event_tail
17562 ;
17563
17564 /**************************************************************************
17565
17566 DEFINER clause support.
17567
17568 **************************************************************************/
17569
17570 definer_opt:
17571 no_definer
17572 | definer
17573 ;
17574
17575 no_definer:
17576 /* empty */
17577 {
17578 /*
17579 We have to distinguish missing DEFINER-clause from case when
17580 CURRENT_USER specified as definer explicitly in order to properly
17581 handle CREATE TRIGGER statements which come to replication thread
17582 from older master servers (i.e. to create non-suid trigger in this
17583 case).
17584 */
17585 35284 YYTHD->lex->definer= 0;
17586 }
17587 ;
17588
17589 definer:
17590 DEFINER_SYM EQ user
17591 {
17592
1/2
✓ Branch 0 taken 318307 times.
✗ Branch 1 not taken.
318307 YYTHD->lex->definer= get_current_user(YYTHD, $3);
17593 }
17594 ;
17595
17596 /**************************************************************************
17597
17598 CREATE VIEW statement parts.
17599
17600 **************************************************************************/
17601
17602 view_replace_or_algorithm:
17603 view_replace
17604 {}
17605 | view_replace view_algorithm
17606 {}
17607 | view_algorithm
17608 {}
17609 ;
17610
17611 view_replace:
17612 OR_SYM REPLACE_SYM
17613 54734 { Lex->create_view_mode= enum_view_create_mode::VIEW_CREATE_OR_REPLACE; }
17614 ;
17615
17616 view_algorithm:
17617 ALGORITHM_SYM EQ UNDEFINED_SYM
17618 714 { Lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED; }
17619 | ALGORITHM_SYM EQ MERGE_SYM
17620 22985 { Lex->create_view_algorithm= VIEW_ALGORITHM_MERGE; }
17621 | ALGORITHM_SYM EQ TEMPTABLE_SYM
17622 21568 { Lex->create_view_algorithm= VIEW_ALGORITHM_TEMPTABLE; }
17623 ;
17624
17625 view_suid:
17626 /* empty */
17627 21468 { Lex->create_view_suid= VIEW_SUID_DEFAULT; }
17628 | SQL_SYM SECURITY_SYM DEFINER_SYM
17629 486 { Lex->create_view_suid= VIEW_SUID_DEFINER; }
17630 | SQL_SYM SECURITY_SYM INVOKER_SYM
17631 45926 { Lex->create_view_suid= VIEW_SUID_INVOKER; }
17632 ;
17633
17634 view_tail:
17635 view_suid VIEW_SYM table_ident opt_derived_column_list
17636 {
17637 67817 THD *thd= YYTHD;
17638 67817 LEX *lex= thd->lex;
17639 67817 lex->sql_command= SQLCOM_CREATE_VIEW;
17640 /* first table in list is target VIEW name */
17641
3/4
✓ Branch 0 taken 67817 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 67812 times.
67817 if (!lex->query_block->add_table_to_list(thd, $3, NULL,
17642 TL_OPTION_UPDATING,
17643 TL_IGNORE,
17644 MDL_EXCLUSIVE))
17645 5 MYSQL_YYABORT;
17646 67812 lex->query_tables->open_strategy= TABLE_LIST::OPEN_STUB;
17647 67812 thd->parsing_system_view= lex->query_tables->is_system_view;
17648
2/2
✓ Branch 0 taken 37930 times.
✓ Branch 1 taken 29882 times.
67812 if ($4.size())
17649 {
17650
2/2
✓ Branch 0 taken 363335 times.
✓ Branch 1 taken 37929 times.
401264 for (auto column_alias : $4)
17651 {
17652 // Report error if the column name/length is incorrect.
17653
3/4
✓ Branch 0 taken 363335 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 363334 times.
363335 if (check_column_name(column_alias.str))
17654 {
17655
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_WRONG_COLUMN_NAME, MYF(0), column_alias.str);
17656 1 MYSQL_YYABORT;
17657 }
17658 }
17659 /*
17660 The $4 object is short-lived (its 'm_array' is not);
17661 so we have to duplicate it, and then we can store a
17662 pointer.
17663 */
17664
1/2
✓ Branch 0 taken 37929 times.
✗ Branch 1 not taken.
37929 void *rawmem= thd->memdup(&($4), sizeof($4));
17665
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 37929 times.
37929 if (!rawmem)
17666 MYSQL_YYABORT; /* purecov: inspected */
17667 37929 lex->query_tables->
17668 37929 set_derived_column_names(static_cast<Create_col_name_list* >(rawmem));
17669 }
17670 }
17671 AS view_query_block
17672 ;
17673
17674 view_query_block:
17675 query_expression_or_parens view_check_option
17676 {
17677 67743 THD *thd= YYTHD;
17678 67743 LEX *lex= Lex;
17679 67743 lex->parsing_options.allows_variable= false;
17680 67743 lex->parsing_options.allows_select_into= false;
17681
17682 /*
17683 In CREATE VIEW v ... the table_list initially contains
17684 here a table entry for the destination "table" `v'.
17685 Backup it and clean the table list for the processing of
17686 the query expression and push `v' back to the beginning of the
17687 table_list finally.
17688
17689 @todo: Don't save the CREATE destination table in
17690 Query_block::table_list and remove this backup & restore.
17691
17692 The following work only with the local list, the global list
17693 is created correctly in this case
17694 */
17695
1/2
✓ Branch 0 taken 67743 times.
✗ Branch 1 not taken.
67743 SQL_I_List<TABLE_LIST> save_list;
17696 67743 Query_block * const save_query_block= Select;
17697
1/2
✓ Branch 0 taken 67743 times.
✗ Branch 1 not taken.
67743 save_query_block->table_list.save_and_clear(&save_list);
17698
17699
9/14
✓ Branch 0 taken 67743 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 67743 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 67743 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 67743 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 67743 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 233 times.
✓ Branch 11 taken 67510 times.
✓ Branch 12 taken 233 times.
✓ Branch 13 taken 67510 times.
67743 CONTEXTUALIZE($1);
17700
17701 /*
17702 The following work only with the local list, the global list
17703 is created correctly in this case
17704 */
17705 67510 save_query_block->table_list.push_front(&save_list);
17706
17707 67510 Lex->create_view_check= $2;
17708
17709 /*
17710 It's simpler to use @$ to grab the whole rule text, OTOH it's
17711 also simple to lose something that way when changing this rule,
17712 so let use explicit @1 and @2 to memdup this view definition:
17713 */
17714 67510 const size_t len= @2.cpp.end - @1.cpp.start;
17715 67510 lex->create_view_query_block.str=
17716
1/2
✓ Branch 0 taken 67510 times.
✗ Branch 1 not taken.
67510 static_cast<char *>(thd->memdup(@1.cpp.start, len));
17717 67510 lex->create_view_query_block.length= len;
17718
1/2
✓ Branch 0 taken 67510 times.
✗ Branch 1 not taken.
67510 trim_whitespace(thd->charset(), &lex->create_view_query_block);
17719
17720 67510 lex->parsing_options.allows_variable= true;
17721 67510 lex->parsing_options.allows_select_into= true;
17722 }
17723 ;
17724
17725 view_check_option:
17726 67389 /* empty */ { $$= VIEW_CHECK_NONE; }
17727 145 | WITH CHECK_SYM OPTION { $$= VIEW_CHECK_CASCADED; }
17728 107 | WITH CASCADED CHECK_SYM OPTION { $$= VIEW_CHECK_CASCADED; }
17729 102 | WITH LOCAL_SYM CHECK_SYM OPTION { $$= VIEW_CHECK_LOCAL; }
17730 ;
17731
17732 /**************************************************************************
17733
17734 CREATE TRIGGER statement parts.
17735
17736 **************************************************************************/
17737
17738 trigger_action_order:
17739 FOLLOWS_SYM
17740 17 { $$= TRG_ORDER_FOLLOWS; }
17741 | PRECEDES_SYM
17742 20 { $$= TRG_ORDER_PRECEDES; }
17743 ;
17744
17745 trigger_follows_precedes_clause:
17746 /* empty */
17747 {
17748 57035 $$.ordering_clause= TRG_ORDER_NONE;
17749 57035 $$.anchor_trigger_name= NULL_CSTR;
17750 }
17751 |
17752 trigger_action_order ident_or_text
17753 {
17754 37 $$.ordering_clause= $1;
17755 37 $$.anchor_trigger_name= { $2.str, $2.length };
17756 }
17757 ;
17758
17759 trigger_tail:
17760 TRIGGER_SYM /* $1 */
17761 opt_if_not_exists /* $2 */
17762 sp_name /* $3 */
17763 trg_action_time /* $4 */
17764 trg_event /* $5 */
17765 ON_SYM /* $6 */
17766 table_ident /* $7 */
17767 FOR_SYM /* $8 */
17768 EACH_SYM /* $9 */
17769 ROW_SYM /* $10 */
17770 trigger_follows_precedes_clause /* $11 */
17771 { /* $12 */
17772 57073 THD *thd= YYTHD;
17773 57073 LEX *lex= thd->lex;
17774
17775
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 57071 times.
57073 if (lex->sphead)
17776 {
17777
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "TRIGGER");
17778 2 MYSQL_YYABORT;
17779 }
17780
17781
1/2
✓ Branch 0 taken 57071 times.
✗ Branch 1 not taken.
57071 sp_head *sp= sp_start_parsing(thd, enum_sp_type::TRIGGER, $3);
17782
17783
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 57071 times.
57071 if (!sp)
17784 MYSQL_YYABORT;
17785
17786 57071 sp->m_trg_chistics.action_time= (enum enum_trigger_action_time_type) $4;
17787 57071 sp->m_trg_chistics.event= (enum enum_trigger_event_type) $5;
17788 57071 sp->m_trg_chistics.ordering_clause= $11.ordering_clause;
17789 57071 sp->m_trg_chistics.anchor_trigger_name= $11.anchor_trigger_name;
17790
17791 57071 lex->stmt_definition_begin= @1.cpp.start;
17792
2/2
✓ Branch 0 taken 15 times.
✓ Branch 1 taken 57056 times.
57071 lex->create_info->options= $2 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
17793 57071 lex->ident.str= const_cast<char *>(@7.cpp.start);
17794 57071 lex->ident.length= @9.cpp.start - @7.cpp.start;
17795
17796 57071 lex->sphead= sp;
17797 57071 lex->spname= $3;
17798
17799 57071 memset(&lex->sp_chistics, 0, sizeof(st_sp_chistics));
17800 57071 sp->m_chistics= &lex->sp_chistics;
17801
1/2
✓ Branch 0 taken 57071 times.
✗ Branch 1 not taken.
57071 sp->set_body_start(thd, @11.cpp.end);
17802 }
17803 sp_proc_stmt /* $13 */
17804 { /* $14 */
17805 56947 THD *thd= YYTHD;
17806 56947 LEX *lex= Lex;
17807 56947 sp_head *sp= lex->sphead;
17808
17809
1/2
✓ Branch 0 taken 56947 times.
✗ Branch 1 not taken.
56947 sp_finish_parsing(thd);
17810
17811 56947 lex->sql_command= SQLCOM_CREATE_TRIGGER;
17812
17813
3/4
✓ Branch 0 taken 56947 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 50 times.
✓ Branch 3 taken 56897 times.
56947 if (sp->is_not_allowed_in_function("trigger"))
17814 50 MYSQL_YYABORT;
17815
17816 /*
17817 We have to do it after parsing trigger body, because some of
17818 sp_proc_stmt alternatives are not saving/restoring LEX, so
17819 lex->query_tables can be wiped out.
17820 */
17821
3/4
✓ Branch 0 taken 56896 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 56891 times.
56897 if (!lex->query_block->add_table_to_list(thd, $7,
17822 nullptr,
17823 TL_OPTION_UPDATING,
17824 TL_READ_NO_INSERT,
17825 MDL_SHARED_NO_WRITE))
17826 5 MYSQL_YYABORT;
17827
17828
1/2
✓ Branch 0 taken 56892 times.
✗ Branch 1 not taken.
113782 Lex->m_sql_cmd= new (YYTHD->mem_root) Sql_cmd_create_trigger();
17829 }
17830 ;
17831
17832 /**************************************************************************
17833
17834 CREATE FUNCTION | PROCEDURE statements parts.
17835
17836 **************************************************************************/
17837
17838 udf_tail:
17839 AGGREGATE_SYM /* $1 */
17840 FUNCTION_SYM /* $2 */
17841 opt_if_not_exists /* $3 */
17842 ident /* $4 */
17843 RETURNS_SYM /* $5 */
17844 udf_type /* $6 */
17845 SONAME_SYM /* $7 */
17846 TEXT_STRING_sys /* $8 */
17847 { /* $9 */
17848 6 THD *thd= YYTHD;
17849 6 LEX *lex= thd->lex;
17850
17851
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
6 if (is_native_function($4))
17852 {
17853 if($3)
17854 {
17855 /*
17856 IF NOT EXISTS clause is unsupported when creating a UDF with
17857 the same name as a native function
17858 */
17859 my_error(ER_IF_NOT_EXISTS_UNSUPPORTED_UDF_NATIVE_FCT_NAME_COLLISION, MYF(0), $4.str);
17860 }
17861 else
17862 my_error(ER_NATIVE_FCT_NAME_COLLISION, MYF(0), $4.str);
17863 MYSQL_YYABORT;
17864 }
17865 6 lex->sql_command = SQLCOM_CREATE_FUNCTION;
17866 6 lex->udf.type= UDFTYPE_AGGREGATE;
17867 6 lex->stmt_definition_begin= @2.cpp.start;
17868
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 lex->create_info->options= $3 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
17869 6 lex->udf.name = $4;
17870 6 lex->udf.returns=(Item_result) $6;
17871 6 lex->udf.dl=$8.str;
17872 }
17873 | FUNCTION_SYM /* $1 */
17874 opt_if_not_exists /* $2 */
17875 ident /* $3 */
17876 RETURNS_SYM /* $4 */
17877 udf_type /* $5 */
17878 SONAME_SYM /* $6 */
17879 TEXT_STRING_sys /* $7 */
17880 {
17881 201 THD *thd= YYTHD;
17882 201 LEX *lex= thd->lex;
17883
17884
3/4
✓ Branch 0 taken 201 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 199 times.
201 if (is_native_function($3))
17885 {
17886
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
2 if($2)
17887 {
17888 /*
17889 IF NOT EXISTS clause is unsupported when creating a UDF with
17890 the same name as a native function
17891 */
17892
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_IF_NOT_EXISTS_UNSUPPORTED_UDF_NATIVE_FCT_NAME_COLLISION, MYF(0), $3.str);
17893 }
17894 else
17895
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_NATIVE_FCT_NAME_COLLISION, MYF(0), $3.str);
17896 2 MYSQL_YYABORT;
17897 }
17898 199 lex->sql_command = SQLCOM_CREATE_FUNCTION;
17899 199 lex->udf.type= UDFTYPE_FUNCTION;
17900 199 lex->stmt_definition_begin= @1.cpp.start;
17901
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 185 times.
199 lex->create_info->options= $2 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
17902 199 lex->udf.name = $3;
17903 199 lex->udf.returns=(Item_result) $5;
17904 199 lex->udf.dl=$7.str;
17905 }
17906 ;
17907
17908 sf_tail:
17909 FUNCTION_SYM /* $1 */
17910 opt_if_not_exists /* $2 */
17911 sp_name /* $3 */
17912 '(' /* $4 */
17913 { /* $5 */
17914 69469 THD *thd= YYTHD;
17915 69469 LEX *lex= thd->lex;
17916
17917 69469 lex->stmt_definition_begin= @1.cpp.start;
17918 69469 lex->spname= $3;
17919
17920
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 69466 times.
69469 if (lex->sphead)
17921 {
17922
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "FUNCTION");
17923 3 MYSQL_YYABORT;
17924 }
17925
17926
17927
1/2
✓ Branch 0 taken 69466 times.
✗ Branch 1 not taken.
69466 sp_head *sp= sp_start_parsing(thd, enum_sp_type::FUNCTION, lex->spname);
17928
17929
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 69466 times.
69466 if (!sp)
17930 MYSQL_YYABORT;
17931
17932 69466 lex->sphead= sp;
17933
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 69449 times.
69466 lex->create_info->options= $2 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
17934
17935 69466 sp->m_parser_data.set_parameter_start_ptr(@4.cpp.end);
17936 }
17937 sp_fdparam_list /* $6 */
17938 ')' /* $7 */
17939 { /* $8 */
17940 69440 Lex->sphead->m_parser_data.set_parameter_end_ptr(@7.cpp.start);
17941 }
17942 RETURNS_SYM /* $9 */
17943 type /* $10 */
17944 opt_collate /* $11 */
17945 { /* $12 */
17946 69437 LEX *lex= Lex;
17947 69437 sp_head *sp= lex->sphead;
17948
17949
7/14
✓ Branch 0 taken 69437 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69437 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 69437 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 69437 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 69437 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 69437 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 69437 times.
69437 CONTEXTUALIZE($10);
17950 69437 enum_field_types field_type= $10->type;
17951
1/2
✓ Branch 0 taken 69437 times.
✗ Branch 1 not taken.
69437 const CHARSET_INFO *cs= $10->get_charset();
17952
3/4
✓ Branch 0 taken 69437 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 69436 times.
69437 if (merge_sp_var_charset_and_collation(cs, $11, &cs))
17953 1 MYSQL_YYABORT;
17954
17955 /*
17956 This was disabled in 5.1.12. See bug #20701
17957 When collation support in SP is implemented, then this test
17958 should be removed.
17959 */
17960
2/2
✓ Branch 0 taken 26500 times.
✓ Branch 1 taken 42670 times.
69170 if ((field_type == MYSQL_TYPE_STRING || field_type == MYSQL_TYPE_VARCHAR)
17961
7/8
✓ Branch 0 taken 69170 times.
✓ Branch 1 taken 266 times.
✓ Branch 2 taken 26766 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 26763 times.
✓ Branch 6 taken 3 times.
✓ Branch 7 taken 69433 times.
138606 && ($10->get_type_flags() & BINCMP_FLAG))
17962 {
17963
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_NOT_SUPPORTED_YET, MYF(0), "return value collation");
17964 3 MYSQL_YYABORT;
17965 }
17966
17967
2/4
✓ Branch 0 taken 69433 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 69433 times.
208299 if (sp->m_return_field_def.init(YYTHD, "", field_type,
17968
1/2
✓ Branch 0 taken 69433 times.
✗ Branch 1 not taken.
69433 $10->get_length(), $10->get_dec(),
17969
2/4
✓ Branch 0 taken 69433 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69433 times.
✗ Branch 3 not taken.
69433 $10->get_type_flags(), NULL, NULL, &NULL_CSTR, 0,
17970
1/2
✓ Branch 0 taken 69433 times.
✗ Branch 1 not taken.
69433 $10->get_interval_list(),
17971 69433 cs ? cs : YYTHD->variables.collation_database,
17972
3/4
✓ Branch 0 taken 69433 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21742 times.
✓ Branch 3 taken 47691 times.
69433 $11 != nullptr, $10->get_uint_geom_type(), nullptr,
17973 nullptr, nullptr, {},
17974 dd::Column::enum_hidden_type::HT_VISIBLE))
17975 {
17976 MYSQL_YYABORT;
17977 }
17978
17979
2/4
✓ Branch 0 taken 69433 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 69433 times.
69433 if (prepare_sp_create_field(YYTHD,
17980 &sp->m_return_field_def))
17981 MYSQL_YYABORT;
17982
17983 69433 memset(&lex->sp_chistics, 0, sizeof(st_sp_chistics));
17984 }
17985 sp_c_chistics /* $13 */
17986 { /* $14 */
17987 69432 THD *thd= YYTHD;
17988 69432 LEX *lex= thd->lex;
17989
17990 69432 lex->sphead->m_chistics= &lex->sp_chistics;
17991
1/2
✓ Branch 0 taken 69432 times.
✗ Branch 1 not taken.
69432 lex->sphead->set_body_start(thd, yylloc.cpp.start);
17992 }
17993 sp_proc_stmt /* $15 */
17994 {
17995 69401 THD *thd= YYTHD;
17996 69401 LEX *lex= thd->lex;
17997 69401 sp_head *sp= lex->sphead;
17998
17999
3/4
✓ Branch 0 taken 69401 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 90 times.
✓ Branch 3 taken 69311 times.
69401 if (sp->is_not_allowed_in_function("function"))
18000 90 MYSQL_YYABORT;
18001
18002
1/2
✓ Branch 0 taken 69311 times.
✗ Branch 1 not taken.
69311 sp_finish_parsing(thd);
18003
18004 69311 lex->sql_command= SQLCOM_CREATE_SPFUNCTION;
18005
18006
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 69310 times.
69311 if (!(sp->m_flags & sp_head::HAS_RETURN))
18007 {
18008
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_NORETURN, MYF(0), sp->m_qname.str);
18009 1 MYSQL_YYABORT;
18010 }
18011
18012
3/4
✓ Branch 0 taken 69310 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2039 times.
✓ Branch 3 taken 67271 times.
69310 if (is_native_function(sp->m_name))
18013 {
18014 /*
18015 This warning will be printed when
18016 [1] A client query is parsed,
18017 [2] A stored function is loaded by db_load_routine.
18018 Printing the warning for [2] is intentional, to cover the
18019 following scenario:
18020 - A user define a SF 'foo' using MySQL 5.N
18021 - An application uses select foo(), and works.
18022 - MySQL 5.{N+1} defines a new native function 'foo', as
18023 part of a new feature.
18024 - MySQL 5.{N+1} documentation is updated, and should mention
18025 that there is a potential incompatible change in case of
18026 existing stored function named 'foo'.
18027 - The user deploys 5.{N+1}. At this point, 'select foo()'
18028 means something different, and the user code is most likely
18029 broken (it's only safe if the code is 'select db.foo()').
18030 With a warning printed when the SF is loaded (which has to occur
18031 before the call), the warning will provide a hint explaining
18032 the root cause of a later failure of 'select foo()'.
18033 With no warning printed, the user code will fail with no
18034 apparent reason.
18035 Printing a warning each time db_load_routine is executed for
18036 an ambiguous function is annoying, since that can happen a lot,
18037 but in practice should not happen unless there *are* name
18038 collisions.
18039 If a collision exists, it should not be silenced but fixed.
18040 */
18041
2/4
✓ Branch 0 taken 2039 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2039 times.
✗ Branch 3 not taken.
2039 push_warning_printf(thd,
18042 Sql_condition::SL_NOTE,
18043 ER_NATIVE_FCT_NAME_COLLISION,
18044 ER_THD(thd, ER_NATIVE_FCT_NAME_COLLISION),
18045 sp->m_name.str);
18046 }
18047 }
18048 ;
18049
18050 sp_tail:
18051 PROCEDURE_SYM /*$1*/
18052 opt_if_not_exists /*$2*/
18053 sp_name /*$3*/
18054 { /*$4*/
18055 157405 THD *thd= YYTHD;
18056 157405 LEX *lex= Lex;
18057
18058
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 157404 times.
157405 if (lex->sphead)
18059 {
18060
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "PROCEDURE");
18061 1 MYSQL_YYABORT;
18062 }
18063
18064 157404 lex->stmt_definition_begin= @1.cpp.start;
18065
18066
1/2
✓ Branch 0 taken 157404 times.
✗ Branch 1 not taken.
157404 sp_head *sp= sp_start_parsing(thd, enum_sp_type::PROCEDURE, $3);
18067
18068
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 157404 times.
157404 if (!sp)
18069 MYSQL_YYABORT;
18070
18071 157404 lex->sphead= sp;
18072
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 157390 times.
157404 lex->create_info->options= $2 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
18073 }
18074 '(' /*$5*/
18075 { /*$6*/
18076 157402 Lex->sphead->m_parser_data.set_parameter_start_ptr(@5.cpp.end);
18077 }
18078 sp_pdparam_list /*$7*/
18079 ')' /*$8*/
18080 { /*$9*/
18081 157395 THD *thd= YYTHD;
18082 157395 LEX *lex= thd->lex;
18083
18084 157395 lex->sphead->m_parser_data.set_parameter_end_ptr(@8.cpp.start);
18085 157396 memset(&lex->sp_chistics, 0, sizeof(st_sp_chistics));
18086 }
18087 sp_c_chistics /*$10*/
18088 { /*$11*/
18089 157390 THD *thd= YYTHD;
18090 157390 LEX *lex= thd->lex;
18091
18092 157390 lex->sphead->m_chistics= &lex->sp_chistics;
18093
1/2
✓ Branch 0 taken 157392 times.
✗ Branch 1 not taken.
157390 lex->sphead->set_body_start(thd, yylloc.cpp.start);
18094 }
18095 sp_proc_stmt /*$12*/
18096 { /*$13*/
18097 155848 THD *thd= YYTHD;
18098 155848 LEX *lex= Lex;
18099
18100
1/2
✓ Branch 0 taken 155848 times.
✗ Branch 1 not taken.
155848 sp_finish_parsing(thd);
18101
18102 155848 lex->sql_command= SQLCOM_CREATE_PROCEDURE;
18103 }
18104 ;
18105
18106 /*************************************************************************/
18107
18108 xa:
18109 XA_SYM begin_or_start xid opt_join_or_resume
18110 {
18111 923 Lex->sql_command = SQLCOM_XA_START;
18112
2/4
✓ Branch 0 taken 923 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 923 times.
✗ Branch 3 not taken.
923 Lex->m_sql_cmd= NEW_PTN Sql_cmd_xa_start($3, $4);
18113 }
18114 | XA_SYM END xid opt_suspend
18115 {
18116 889 Lex->sql_command = SQLCOM_XA_END;
18117
2/4
✓ Branch 0 taken 889 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 889 times.
✗ Branch 3 not taken.
889 Lex->m_sql_cmd= NEW_PTN Sql_cmd_xa_end($3, $4);
18118 }
18119 | XA_SYM PREPARE_SYM xid
18120 {
18121 410 Lex->sql_command = SQLCOM_XA_PREPARE;
18122
2/4
✓ Branch 0 taken 410 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 410 times.
✗ Branch 3 not taken.
410 Lex->m_sql_cmd= NEW_PTN Sql_cmd_xa_prepare($3);
18123 }
18124 | XA_SYM COMMIT_SYM xid opt_one_phase
18125 {
18126 590 Lex->sql_command = SQLCOM_XA_COMMIT;
18127
2/4
✓ Branch 0 taken 590 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 590 times.
✗ Branch 3 not taken.
590 Lex->m_sql_cmd= NEW_PTN Sql_cmd_xa_commit($3, $4);
18128 }
18129 | XA_SYM ROLLBACK_SYM xid
18130 {
18131 273 Lex->sql_command = SQLCOM_XA_ROLLBACK;
18132
2/4
✓ Branch 0 taken 273 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 273 times.
✗ Branch 3 not taken.
273 Lex->m_sql_cmd= NEW_PTN Sql_cmd_xa_rollback($3);
18133 }
18134 | XA_SYM RECOVER_SYM opt_convert_xid
18135 {
18136 253 Lex->sql_command = SQLCOM_XA_RECOVER;
18137
2/4
✓ Branch 0 taken 253 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 253 times.
✗ Branch 3 not taken.
253 Lex->m_sql_cmd= NEW_PTN Sql_cmd_xa_recover($3);
18138 }
18139 ;
18140
18141 opt_convert_xid:
18142 249 /* empty */ { $$= false; }
18143 4 | CONVERT_SYM XID_SYM { $$= true; }
18144
18145 xid:
18146 text_string
18147 {
18148
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1739 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1740 MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE);
18149 XID *xid;
18150
2/4
✓ Branch 0 taken 1739 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1739 times.
1739 if (!(xid= (XID *)YYTHD->alloc(sizeof(XID))))
18151 MYSQL_YYABORT;
18152
1/2
✓ Branch 0 taken 1739 times.
✗ Branch 1 not taken.
1739 xid->set(1L, $1->ptr(), $1->length(), 0, 0);
18153 1739 $$= xid;
18154 }
18155 | text_string ',' text_string
18156 {
18157
3/8
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 37 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 37 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
37 MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE &&
18158 $3->length() <= MAXBQUALSIZE);
18159 XID *xid;
18160
2/4
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 37 times.
37 if (!(xid= (XID *)YYTHD->alloc(sizeof(XID))))
18161 MYSQL_YYABORT;
18162
1/2
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
37 xid->set(1L, $1->ptr(), $1->length(), $3->ptr(), $3->length());
18163 37 $$= xid;
18164 }
18165 | text_string ',' text_string ',' ulong_num
18166 {
18167 // check for overwflow of xid format id
18168 1311 bool format_id_overflow_detected= ($5 > LONG_MAX);
18169
18170
7/10
✓ Branch 0 taken 1311 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1311 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 1309 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 1309 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
1311 MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE &&
18171 $3->length() <= MAXBQUALSIZE
18172 && !format_id_overflow_detected);
18173
18174 XID *xid;
18175
2/4
✓ Branch 0 taken 1309 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1309 times.
1309 if (!(xid= (XID *)YYTHD->alloc(sizeof(XID))))
18176 MYSQL_YYABORT;
18177
1/2
✓ Branch 0 taken 1309 times.
✗ Branch 1 not taken.
1309 xid->set($5, $1->ptr(), $1->length(), $3->ptr(), $3->length());
18178 1309 $$= xid;
18179 }
18180 ;
18181
18182 begin_or_start:
18183 BEGIN_SYM {}
18184 | START_SYM {}
18185 ;
18186
18187 opt_join_or_resume:
18188 917 /* nothing */ { $$= XA_NONE; }
18189 | JOIN_SYM { $$= XA_JOIN; }
18190 6 | RESUME_SYM { $$= XA_RESUME; }
18191 ;
18192
18193 opt_one_phase:
18194 521 /* nothing */ { $$= XA_NONE; }
18195 69 | ONE_SYM PHASE_SYM { $$= XA_ONE_PHASE; }
18196 ;
18197
18198 opt_suspend:
18199 /* nothing */
18200 887 { $$= XA_NONE; }
18201 | SUSPEND_SYM
18202 2 { $$= XA_SUSPEND; }
18203 | SUSPEND_SYM FOR_SYM MIGRATE_SYM
18204 { $$= XA_FOR_MIGRATE; }
18205 ;
18206
18207 install:
18208 INSTALL_SYM PLUGIN_SYM ident SONAME_SYM TEXT_STRING_sys
18209 {
18210 730 LEX *lex= Lex;
18211 730 lex->sql_command= SQLCOM_INSTALL_PLUGIN;
18212
1/2
✓ Branch 0 taken 730 times.
✗ Branch 1 not taken.
730 lex->m_sql_cmd= new (YYMEM_ROOT) Sql_cmd_install_plugin(to_lex_cstring($3), $5);
18213 }
18214 | INSTALL_SYM COMPONENT_SYM TEXT_STRING_sys_list
18215 {
18216 503 LEX *lex= Lex;
18217 503 lex->sql_command= SQLCOM_INSTALL_COMPONENT;
18218
1/2
✓ Branch 0 taken 503 times.
✗ Branch 1 not taken.
503 lex->m_sql_cmd= new (YYMEM_ROOT) Sql_cmd_install_component($3);
18219 }
18220 ;
18221
18222 uninstall:
18223 UNINSTALL_SYM PLUGIN_SYM ident
18224 {
18225 738 LEX *lex= Lex;
18226 738 lex->sql_command= SQLCOM_UNINSTALL_PLUGIN;
18227
1/2
✓ Branch 0 taken 738 times.
✗ Branch 1 not taken.
738 lex->m_sql_cmd= new (YYMEM_ROOT) Sql_cmd_uninstall_plugin(to_lex_cstring($3));
18228 }
18229 | UNINSTALL_SYM COMPONENT_SYM TEXT_STRING_sys_list
18230 {
18231 507 LEX *lex= Lex;
18232 507 lex->sql_command= SQLCOM_UNINSTALL_COMPONENT;
18233
1/2
✓ Branch 0 taken 507 times.
✗ Branch 1 not taken.
507 lex->m_sql_cmd= new (YYMEM_ROOT) Sql_cmd_uninstall_component($3);
18234 }
18235 ;
18236
18237 TEXT_STRING_sys_list:
18238 TEXT_STRING_sys
18239 {
18240 1045 $$.init(YYTHD->mem_root);
18241
2/4
✓ Branch 0 taken 1045 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1045 times.
1045 if ($$.push_back($1))
18242 MYSQL_YYABORT; // OOM
18243 }
18244 | TEXT_STRING_sys_list ',' TEXT_STRING_sys
18245 {
18246 55 $$= $1;
18247
2/4
✓ Branch 0 taken 55 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 55 times.
55 if ($$.push_back($3))
18248 MYSQL_YYABORT; // OOM
18249 }
18250 ;
18251
18252 import_stmt:
18253 IMPORT TABLE_SYM FROM TEXT_STRING_sys_list
18254 {
18255 35 LEX *lex= Lex;
18256 35 lex->m_sql_cmd=
18257
2/4
✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35 times.
✗ Branch 3 not taken.
35 new (YYTHD->mem_root) Sql_cmd_import_table($4);
18258
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
35 if (lex->m_sql_cmd == NULL)
18259 MYSQL_YYABORT;
18260 35 lex->sql_command= SQLCOM_IMPORT;
18261 }
18262 ;
18263
18264 /**************************************************************************
18265
18266 Clone local/remote replica statements.
18267
18268 **************************************************************************/
18269 clone_stmt:
18270 CLONE_SYM LOCAL_SYM
18271 DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_filesystem
18272 {
18273 124 Lex->sql_command= SQLCOM_CLONE;
18274
1/2
✓ Branch 0 taken 124 times.
✗ Branch 1 not taken.
124 Lex->m_sql_cmd= NEW_PTN Sql_cmd_clone(to_lex_cstring($6));
18275
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 124 times.
124 if (Lex->m_sql_cmd == nullptr)
18276 MYSQL_YYABORT;
18277 }
18278
18279 | CLONE_SYM INSTANCE_SYM FROM user ':' ulong_num
18280 IDENTIFIED_SYM BY TEXT_STRING_sys
18281 opt_datadir_ssl
18282 {
18283 203 Lex->sql_command= SQLCOM_CLONE;
18284 /* Reject space characters around ':' */
18285
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 203 times.
203 if (@6.raw.start - @4.raw.end != 1) {
18286 YYTHD->syntax_error_at(@5);
18287 MYSQL_YYABORT;
18288 }
18289 203 $4->first_factor_auth_info.auth = to_lex_cstring($9);
18290 203 $4->first_factor_auth_info.uses_identified_by_clause = true;
18291 203 Lex->contains_plaintext_password= true;
18292
18293
2/4
✓ Branch 0 taken 203 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 203 times.
✗ Branch 3 not taken.
203 Lex->m_sql_cmd= NEW_PTN Sql_cmd_clone($4, $6, to_lex_cstring($10));
18294
18295
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 203 times.
203 if (Lex->m_sql_cmd == nullptr)
18296 MYSQL_YYABORT;
18297 }
18298 ;
18299
18300 opt_datadir_ssl:
18301 opt_ssl
18302 {
18303 70 $$= null_lex_str;
18304 }
18305 | DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_filesystem opt_ssl
18306 {
18307 133 $$= $4;
18308 }
18309 ;
18310
18311 opt_ssl:
18312 /* empty */
18313 {
18314 141 Lex->ssl_type= SSL_TYPE_NOT_SPECIFIED;
18315 }
18316 | REQUIRE_SYM SSL_SYM
18317 {
18318 9 Lex->ssl_type= SSL_TYPE_SPECIFIED;
18319 }
18320 | REQUIRE_SYM NO_SYM SSL_SYM
18321 {
18322 53 Lex->ssl_type= SSL_TYPE_NONE;
18323 }
18324 ;
18325
18326 resource_group_types:
18327 24 USER { $$= resourcegroups::Type::USER_RESOURCE_GROUP; }
18328 1 | SYSTEM_SYM { $$= resourcegroups::Type::SYSTEM_RESOURCE_GROUP; }
18329 ;
18330
18331 opt_resource_group_vcpu_list:
18332 /* empty */
18333 {
18334 /* Make an empty list. */
18335
2/4
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
✗ Branch 3 not taken.
13 $$= NEW_PTN Mem_root_array<resourcegroups::Range>(YYMEM_ROOT);
18336
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
13 if ($$ == nullptr)
18337 MYSQL_YYABORT;
18338 }
18339 31 | VCPU_SYM opt_equal vcpu_range_spec_list { $$= $3; }
18340 ;
18341
18342 vcpu_range_spec_list:
18343 vcpu_num_or_range
18344 {
18345 31 resourcegroups::Range r($1.start, $1.end);
18346
2/4
✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
✗ Branch 3 not taken.
31 $$= NEW_PTN Mem_root_array<resourcegroups::Range>(YYMEM_ROOT);
18347
4/8
✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 31 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 31 times.
31 if ($$ == nullptr || $$->push_back(r))
18348 MYSQL_YYABORT;
18349 }
18350 | vcpu_range_spec_list opt_comma vcpu_num_or_range
18351 {
18352 2 resourcegroups::Range r($3.start, $3.end);
18353 2 $$= $1;
18354
4/8
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
2 if ($$ == nullptr || $$->push_back(r))
18355 MYSQL_YYABORT;
18356 }
18357 ;
18358
18359 vcpu_num_or_range:
18360 NUM
18361 {
18362 13 auto cpu_id= my_strtoull($1.str, nullptr, 10);
18363 13 $$.start= $$.end=
18364 static_cast<resourcegroups::platform::cpu_id_t>(cpu_id);
18365
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
13 assert($$.start == cpu_id); // truncation check
18366 }
18367 | NUM '-' NUM
18368 {
18369 20 auto start= my_strtoull($1.str, nullptr, 10);
18370 20 $$.start= static_cast<resourcegroups::platform::cpu_id_t>(start);
18371
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
20 assert($$.start == start); // truncation check
18372
18373 20 auto end= my_strtoull($3.str, nullptr, 10);
18374 20 $$.end= static_cast<resourcegroups::platform::cpu_id_t>(end);
18375
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
20 assert($$.end == end); // truncation check
18376 }
18377 ;
18378
18379 signed_num:
18380 13 NUM { $$= static_cast<int>(my_strtoll($1.str, nullptr, 10)); }
18381 3 | '-' NUM { $$= -static_cast<int>(my_strtoll($2.str, nullptr, 10)); }
18382 ;
18383
18384 opt_resource_group_priority:
18385 28 /* empty */ { $$.is_default= true; }
18386 | THREAD_PRIORITY_SYM opt_equal signed_num
18387 {
18388 16 $$.is_default= false;
18389 16 $$.value= $3;
18390 }
18391 ;
18392
18393 opt_resource_group_enable_disable:
18394 38 /* empty */ { $$.is_default= true; }
18395 | ENABLE_SYM
18396 {
18397 1 $$.is_default= false;
18398 1 $$.value= true;
18399 }
18400 | DISABLE_SYM
18401 {
18402 5 $$.is_default= false;
18403 5 $$.value= false;
18404 }
18405 ;
18406
18407 opt_force:
18408 31 /* empty */ { $$= false; }
18409 9 | FORCE_SYM { $$= true; }
18410 ;
18411
18412
18413 json_attribute:
18414 TEXT_STRING_sys
18415 {
18416
2/2
✓ Branch 0 taken 210 times.
✓ Branch 1 taken 11 times.
221 if ($1.str[0] != '\0') {
18417 210 size_t eoff = 0;
18418 210 std::string emsg;
18419
3/4
✓ Branch 0 taken 210 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 200 times.
210 if (!is_valid_json_syntax($1.str, $1.length, &eoff, &emsg,
18420 JsonDocumentDefaultDepthHandler)) {
18421
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 my_error(ER_INVALID_JSON_ATTRIBUTE, MYF(0),
18422 10 emsg.c_str(), eoff, $1.str+eoff);
18423 10 MYSQL_YYABORT;
18424 }
18425
2/2
✓ Branch 0 taken 200 times.
✓ Branch 1 taken 10 times.
210 }
18426 211 $$ = to_lex_cstring($1);
18427 }
18428
18429 /**
18430 @} (end of group Parser)
18431 */
18432